Re: simplest of code

Bob Matthews <[email protected]>
Newsgroups gmane.comp.ai.weka
Message-ID <[email protected]>
OK................

I have the following code:-

*********************

OSV = ((mid_price_close - PDCC)/PDCC) / btheta;

//************************************************************************
   // run weka and make a prediction
     /**
    * Performs a prediction.
    *
    * @param v the value of the input variable to use for making a 
prediction
    * @return the predicted value (class index), returns -1 if it fails 
to make prediction
    * @throws Exception if prediction fails
    */
   try {
       // [B] create instance
       // create the current instance
       double[] values = new double[header.numAttributes()];
       for (int i = 0; i < values.length; i++)
         values[i] = Utils.missingValue();
       // - numeric
       values[0] = OSV;
       DenseInstance currentInstance = new DenseInstance(1.0, values);
       currentInstance.setDataset(header);

       // [C] classify nominal class
       // classifyInstance() just returns the index of the predicted 
label (the one with the highest probability) as a double
       double prediction = cls.classifyInstance(currentInstance);
       System.out.println("prediction: " + prediction);

       return (int) prediction;
   }

*******************************

Errow message:-

Syntax error, [on the last line] insert "Finally" to complete try 
statement ??

Bob M

On 11/9/2021 4:52 PM, Peter Reutemann wrote:

_______________________________________________
Wekalist mailing list -- [email protected]
Send posts to [email protected]
To unsubscribe send an email to [email protected]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.