doubt about pca

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

doubt about pca

Jovani Souza
Hello,

Could you please help me.

I am reducing the dimensionality of my data through Filter-Unsupervised-Principal Component Analysis.
My base contained 12000 attributes and after using pca, reduced to 180 attributes. So, is it correct to say that the method reduced 11820 attributes?

Thank you so much!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Keerthivasan K
Hai,

I hope you can say the attributes were reduced to 180. This is because none of the 180 attributes is the same one in the old 12000.

What you mean is correct but I am afraid it is not appropriate.


~ Keerthi Vasan, K.

On 10 April 2017 at 10:40, Jovani Souza <[hidden email]> wrote:
Hello,

Could you please help me.

I am reducing the dimensionality of my data through
Filter-Unsupervised-Principal Component Analysis.
My base contained 12000 attributes and after using pca, reduced to 180
attributes. So, is it correct to say that the method reduced 11820
attributes?

Thank you so much!



--
View this message in context: http://weka.8497.n7.nabble.com/doubt-about-pca-tp40088.html
Sent from the WEKA mailing list archive at Nabble.com.
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Jovani Souza
Thanks for the answer. Sorry, but why do you think it's not appropriate?

2017-04-10 9:54 GMT-03:00 Keerthivasan K <[hidden email]>:
Hai,

I hope you can say the attributes were reduced to 180. This is because none of the 180 attributes is the same one in the old 12000.

What you mean is correct but I am afraid it is not appropriate.


~ Keerthi Vasan, K.

On 10 April 2017 at 10:40, Jovani Souza <[hidden email]> wrote:
Hello,

Could you please help me.

I am reducing the dimensionality of my data through
Filter-Unsupervised-Principal Component Analysis.
My base contained 12000 attributes and after using pca, reduced to 180
attributes. So, is it correct to say that the method reduced 11820
attributes?

Thank you so much!



--
View this message in context: http://weka.8497.n7.nabble.com/doubt-about-pca-tp40088.html
Sent from the WEKA mailing list archive at Nabble.com.
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html



_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Jovani Souza
Eibe,

What do you think about it?

Thank you!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Jovani Souza
Hello,

Could someone else help me please?

Thank you again!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Eibe Frank-2
Administrator
PCA does not really perform attribute selection. You can say that it performs dimensionality reduction through feature extraction.

Cheers,
Eibe

> On 12/04/2017, at 7:27 AM, Jovani Souza <[hidden email]> wrote:
>
> Hello,
>
> Could someone else help me please?
>
> Thank you again!
>
>
>
> --
> View this message in context: http://weka.8497.n7.nabble.com/doubt-about-pca-tp40088p40105.html
> Sent from the WEKA mailing list archive at Nabble.com.
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Jovani Souza
Sorry, but I did not understand. The PCA does not select attributes, but how can I interpret these 180 attributes selected through the method? What are these selected attributes?

Thank you!

2017-04-11 23:03 GMT-03:00 Eibe Frank <[hidden email]>:
PCA does not really perform attribute selection. You can say that it performs dimensionality reduction through feature extraction.

Cheers,
Eibe

> On 12/04/2017, at 7:27 AM, Jovani Souza <[hidden email]> wrote:
>
> Hello,
>
> Could someone else help me please?
>
> Thank you again!
>
>
>
> --
> View this message in context: http://weka.8497.n7.nabble.com/doubt-about-pca-tp40088p40105.html
> Sent from the WEKA mailing list archive at Nabble.com.
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Peter Reutemann
> Sorry, but I did not understand. The PCA does not select attributes, but how
> can I interpret these 180 attributes selected through the method? What are
> these selected attributes?

"Principal component analysis (PCA) is a statistical procedure that
uses an orthogonal transformation to convert a set of observations of
possibly correlated variables into a set of values of linearly
uncorrelated variables called principal components (or sometimes,
principal modes of variation). The number of principal components is
less than or equal to the smaller of the number of original variables
or the number of observations."

-- source: https://en.wikipedia.org/wiki/Principal_component_analysis

Cheers, Peter
--
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 858-5174
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Michael Hall
In reply to this post by Jovani Souza
> On Apr 11, 2017, at 11:09 PM, Jovani Souza <[hidden email]> wrote:
>
> Sorry, but I did not understand. The PCA does not select attributes, but how can I interpret these 180 attributes selected through the method? What are these selected attributes?

My understanding, possibly not entirely correct either if someone wants to correct me, is that PCA creates higher dimensional attributes by somehow combining the values of multiple attributes from the original data.
It is different from SVD, singular value decomposition, as in R, where each attribute is ranked according to how much it contributes to the data variance.
If that is more what you want, attribute selection by SVD, I’m not sure how you manage that in Weka and I have wondered the same before myself.

Michael Hall




_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: doubt about pca

Eibe Frank-2
Administrator
Yes, the features extracted by PCA consist of linear combinations of the original attributes.

Cheers,
Eibe

> On 12 Apr 2017, at 20:56, Michael Hall <[hidden email]> wrote:
>
>> On Apr 11, 2017, at 11:09 PM, Jovani Souza <[hidden email]> wrote:
>>
>> Sorry, but I did not understand. The PCA does not select attributes, but how can I interpret these 180 attributes selected through the method? What are these selected attributes?
>
> My understanding, possibly not entirely correct either if someone wants to correct me, is that PCA creates higher dimensional attributes by somehow combining the values of multiple attributes from the original data.
> It is different from SVD, singular value decomposition, as in R, where each attribute is ranked according to how much it contributes to the data variance.
> If that is more what you want, attribute selection by SVD, I’m not sure how you manage that in Weka and I have wondered the same before myself.
>
> Michael Hall
>
>
>
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

some coding advice please

Bob Matthews
I utilize weka from within a java program
My time frame is 6 hours
I have an instances table consisting of a constant number of  4,100
instances which is updated with a new instance every 6 hours and the
oldest instanced is deleted
Thus my test set of 100 instances is changing every 6 hours
I perform data mining every six hours with the new training set of 4,000
instances
Every 6 hours, after I have retrained the model with the updated
training set, I perform some arithmetic and decide to either keep the
'old' model or replace it with the 'newer retrained' model

So, basic steps are as follows:
(1) read in saved 'old' model
(2) get this model to predict for each instance in the test set of 100
instances
(3) carry out a simulation of trades
(4) calculate a couple of variables
then
(5) retrain the model
and repeat (2) thru (4) above
Compare the values of the two sets of variables and decide which of the
two models to keep

I am unsure how to code step(2) above

i.e. step (1)

// deserialize model
ObjectInputStream ois = new ObjectInputStream(
                            new
FileInputStream("C:/****************/Model1/KStar1.model"));
FilteredClassifier fcs_all = (FilteredClassifier) ois.readObject();
ois.close();

step(2) - does this look OK ?

loop thru 100 instances in the test set
k = 0;
while (k < 100) {
//retrieve the kth instance in the testing set
Instance kthInstance = testing.instance(k+1);
// classifyInstance() just returns the index of the predicted label (the
one with the highest probability) as a double
pred = fcs_all.classifyInstance(kthInstance);
}

Bob M
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: some coding advice please

Eibe Frank-2
Administrator
Yes, that looks fine, but your indexing is off by one. Change

Instance kthInstance = testing.instance(k+1);

to

Instance kthInstance = testing.instance(k);

WEKA uses 0-based indexing internally. 1-based indexing is only used for indexing through the various user interfaces.

Cheers,
Eibe

> On 13 Apr 2017, at 10:49, Bob Matthews <[hidden email]> wrote:
>
> I utilize weka from within a java program
> My time frame is 6 hours
> I have an instances table consisting of a constant number of  4,100 instances which is updated with a new instance every 6 hours and the oldest instanced is deleted
> Thus my test set of 100 instances is changing every 6 hours
> I perform data mining every six hours with the new training set of 4,000 instances
> Every 6 hours, after I have retrained the model with the updated training set, I perform some arithmetic and decide to either keep the 'old' model or replace it with the 'newer retrained' model
>
> So, basic steps are as follows:
> (1) read in saved 'old' model
> (2) get this model to predict for each instance in the test set of 100 instances
> (3) carry out a simulation of trades
> (4) calculate a couple of variables
> then
> (5) retrain the model
> and repeat (2) thru (4) above
> Compare the values of the two sets of variables and decide which of the two models to keep
>
> I am unsure how to code step(2) above
>
> i.e. step (1)
>
> // deserialize model
> ObjectInputStream ois = new ObjectInputStream(
>                           new FileInputStream("C:/****************/Model1/KStar1.model"));
> FilteredClassifier fcs_all = (FilteredClassifier) ois.readObject();
> ois.close();
>
> step(2) - does this look OK ?
>
> loop thru 100 instances in the test set
> k = 0;
> while (k < 100) {
> //retrieve the kth instance in the testing set
> Instance kthInstance = testing.instance(k+1);
> // classifyInstance() just returns the index of the predicted label (the one with the highest probability) as a double
> pred = fcs_all.classifyInstance(kthInstance);
> }
>
> Bob M
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: some coding advice please

Bob Matthews
Thank you Eibe :)

Bob M

On 13-Apr-17 10:56 AM, Eibe Frank wrote:
> Yes, that looks fine, but your indexing is off by one. Change
>

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Java errors - Retrieving data from instances

Bob Matthews
In reply to this post by Eibe Frank-2

Hello Eibe

I have the following code.......................

ObjectInputStream ois = new ObjectInputStream(
                           new FileInputStream("C:/............/KStar1.model"));
FilteredClassifier fcs_all = (FilteredClassifier) ois.readObject();
ois.close();

//retrieve the lth instance in the testing set
Instance lthInstance = testing.instance(l);

// get index, OHLC prices and the take profit from (l)th instance
sim_trading_date = lthInstance.attribute(Trading_Date, 0);
sim_trading_time = lthInstance.attribute(Trading_Time, 1);
In the above 2 lines, it cannot find the variables

sim_open_price = lthInstance.attribute(open_price, 2);
sim_high_price = lthInstance.attribute(high_price, 3);
sim_low_price = lthInstance.attribute(low_price, 4);
sim_close_price = lthInstance.attribute(close_price, 5);
sim_take_profit = lthInstance.attribute(take_profit, 15);
In the above 5 lines, method attribute cannot be applied

// classifyInstance() just returns the index of the predicted label (the one with the highest probability) as a double
pred = fcs_all.classifyInstance(lthInstance);
Cannot find variable fcs_all

Is there something obvious that I am doing wrong here?

Bob M

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java errors - Retrieving data from instances

Mark Hall
The Instance interface does not have a two-argument method for retrieving an attribute:


On 2/05/17, 7:27 PM, "Bob Matthews" <[hidden email] on behalf of [hidden email]> wrote:

   
     
       
     
     
        Hello Eibe
       
        I have the following code.......................
       
        ObjectInputStream ois =
            new ObjectInputStream(
                                       new
            FileInputStream("C:/............/KStar1.model"));
            FilteredClassifier fcs_all = (FilteredClassifier)
            ois.readObject();
            ois.close();
         
        //retrieve the lth instance in the testing set
        Instance lthInstance = testing.instance(l);
       
        // get index, OHLC prices and the take profit from (l)th instance
        sim_trading_date = lthInstance.attribute(Trading_Date, 0);
        sim_trading_time = lthInstance.attribute(Trading_Time, 1);
        In the above 2 lines, it cannot find the
          variables
       
        sim_open_price = lthInstance.attribute(open_price, 2);
        sim_high_price = lthInstance.attribute(high_price, 3);
        sim_low_price = lthInstance.attribute(low_price, 4);
        sim_close_price = lthInstance.attribute(close_price, 5);
        sim_take_profit = lthInstance.attribute(take_profit, 15);
        In the above 5 lines, method attribute cannot
          be applied
       
        // classifyInstance() just returns the index of the predicted label
        (the one with the highest probability) as a double
        pred = fcs_all.classifyInstance(lthInstance);
          Cannot find variable fcs_all
         
          Is there something obvious that I am doing
            wrong here?
         
          Bob M
       
     
   
    _______________________________________________
    Wekalist mailing list
    Send posts to: [hidden email]
    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
   


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java errors - Retrieving data from instances

Mark Hall
In reply to this post by Bob Matthews
My mail client had a fit – the rest of my message was going to be:

See:
http://weka.sourceforge.net/doc.stable-3-8/weka/core/Instance.html

Cheers,
Mark.

On 2/05/17, 7:27 PM, "Bob Matthews" <[hidden email] on behalf of [hidden email]> wrote:

   
     
       
     
     
        Hello Eibe
       
        I have the following code.......................
       
        ObjectInputStream ois =
            new ObjectInputStream(
                                       new
            FileInputStream("C:/............/KStar1.model"));
            FilteredClassifier fcs_all = (FilteredClassifier)
            ois.readObject();
            ois.close();
         
        //retrieve the lth instance in the testing set
        Instance lthInstance = testing.instance(l);
       
        // get index, OHLC prices and the take profit from (l)th instance
        sim_trading_date = lthInstance.attribute(Trading_Date, 0);
        sim_trading_time = lthInstance.attribute(Trading_Time, 1);
        In the above 2 lines, it cannot find the
          variables
       
        sim_open_price = lthInstance.attribute(open_price, 2);
        sim_high_price = lthInstance.attribute(high_price, 3);
        sim_low_price = lthInstance.attribute(low_price, 4);
        sim_close_price = lthInstance.attribute(close_price, 5);
        sim_take_profit = lthInstance.attribute(take_profit, 15);
        In the above 5 lines, method attribute cannot
          be applied
       
        // classifyInstance() just returns the index of the predicted label
        (the one with the highest probability) as a double
        pred = fcs_all.classifyInstance(lthInstance);
          Cannot find variable fcs_all
         
          Is there something obvious that I am doing
            wrong here?
         
          Bob M
       
     
   
    _______________________________________________
    Wekalist mailing list
    Send posts to: [hidden email]
    List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
   


_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java errors - Retrieving data from instances

Bob Matthews
Hi Mark

should I use something like

sim_trading_date = lthInstance.attribute( 0);

sim_trading_time = lthInstance.attribute(1);
         

On 5/2/17 8:13 PM, Mark Hall wrote:
> My mail client had a fit – the rest of my message was going to be:
>
> See:
> http://weka.sourceforge.net/doc.stable-3-8/weka/core/Instance.html
>
> Cheers,
> Mark.
>
>

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java errors - Retrieving data from instances

Bob Matthews
In reply to this post by Mark Hall
Hi Mark

now have the following code.............

// get index, OHLC prices and the take profit from (l)th instance
sim_trading_date = lthInstance.value(0);
sim_trading_time = lthInstance.value(1);
sim_open_price = lthInstance.value(2);
sim_high_price = lthInstance.value(3);
sim_low_price = lthInstance.value(4);
sim_close_price = lthInstance.value(5);
sim_take_profit = lthInstance.value(15);

seems to be OK

so my only problem is why it is not recognizing fcs_all

Bob M

On 5/2/17 8:13 PM, Mark Hall wrote:

> My mail client had a fit – the rest of my message was going to be:
>
> See:
> http://weka.sourceforge.net/doc.stable-3-8/weka/core/Instance.html
>
> Cheers,
> Mark.
>
> On 2/05/17, 7:27 PM, "Bob Matthews" <[hidden email] on behalf of [hidden email]> wrote:
>
>      
>        
>          
>        
>        
>          Hello Eibe
>          
>          I have the following code.......................
>          
>          ObjectInputStream ois =
>              new ObjectInputStream(
>                                         new
>              FileInputStream("C:/............/KStar1.model"));
>              FilteredClassifier fcs_all = (FilteredClassifier)
>              ois.readObject();
>              ois.close();
>            
>          //retrieve the lth instance in the testing set
>          Instance lthInstance = testing.instance(l);
>          
>          // get index, OHLC prices and the take profit from (l)th instance
>          sim_trading_date = lthInstance.attribute(Trading_Date, 0);
>          sim_trading_time = lthInstance.attribute(Trading_Time, 1);
>          In the above 2 lines, it cannot find the
>            variables
>          
>          sim_open_price = lthInstance.attribute(open_price, 2);
>          sim_high_price = lthInstance.attribute(high_price, 3);
>          sim_low_price = lthInstance.attribute(low_price, 4);
>          sim_close_price = lthInstance.attribute(close_price, 5);
>          sim_take_profit = lthInstance.attribute(take_profit, 15);
>          In the above 5 lines, method attribute cannot
>            be applied
>          
>          // classifyInstance() just returns the index of the predicted label
>          (the one with the highest probability) as a double
>          pred = fcs_all.classifyInstance(lthInstance);
>            Cannot find variable fcs_all
>            
>            Is there something obvious that I am doing
>              wrong here?
>            
>            Bob M
>          
>        
>      
>      _______________________________________________
>      Wekalist mailing list
>      Send posts to: [hidden email]
>      List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>      List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>      
>
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Java errors - Retrieving data from instances

Eibe Frank-2
Administrator
It should find fcs_all if all your code is in the same Java method.

Cheers,
Eibe

> On 2/05/2017, at 9:00 PM, Bob Matthews <[hidden email]> wrote:
>
> Hi Mark
>
> now have the following code.............
>
> // get index, OHLC prices and the take profit from (l)th instance
> sim_trading_date = lthInstance.value(0);
> sim_trading_time = lthInstance.value(1);
> sim_open_price = lthInstance.value(2);
> sim_high_price = lthInstance.value(3);
> sim_low_price = lthInstance.value(4);
> sim_close_price = lthInstance.value(5);
> sim_take_profit = lthInstance.value(15);
>
> seems to be OK
>
> so my only problem is why it is not recognizing fcs_all
>
> Bob M
>
> On 5/2/17 8:13 PM, Mark Hall wrote:
>> My mail client had a fit – the rest of my message was going to be:
>>
>> See:
>> http://weka.sourceforge.net/doc.stable-3-8/weka/core/Instance.html
>>
>> Cheers,
>> Mark.
>>
>> On 2/05/17, 7:27 PM, "Bob Matthews" <[hidden email] on behalf of [hidden email]> wrote:
>>
>>                                            Hello Eibe
>>                  I have the following code.......................
>>                  ObjectInputStream ois =
>>             new ObjectInputStream(
>>                                        new
>>             FileInputStream("C:/............/KStar1.model"));
>>             FilteredClassifier fcs_all = (FilteredClassifier)
>>             ois.readObject();
>>             ois.close();
>>                    //retrieve the lth instance in the testing set
>>         Instance lthInstance = testing.instance(l);
>>                  // get index, OHLC prices and the take profit from (l)th instance
>>         sim_trading_date = lthInstance.attribute(Trading_Date, 0);
>>         sim_trading_time = lthInstance.attribute(Trading_Time, 1);
>>         In the above 2 lines, it cannot find the
>>           variables
>>                  sim_open_price = lthInstance.attribute(open_price, 2);
>>         sim_high_price = lthInstance.attribute(high_price, 3);
>>         sim_low_price = lthInstance.attribute(low_price, 4);
>>         sim_close_price = lthInstance.attribute(close_price, 5);
>>         sim_take_profit = lthInstance.attribute(take_profit, 15);
>>         In the above 5 lines, method attribute cannot
>>           be applied
>>                  // classifyInstance() just returns the index of the predicted label
>>         (the one with the highest probability) as a double
>>         pred = fcs_all.classifyInstance(lthInstance);
>>           Cannot find variable fcs_all
>>                      Is there something obvious that I am doing
>>             wrong here?
>>                      Bob M
>>                          _______________________________________________
>>     Wekalist mailing list
>>     Send posts to: [hidden email]
>>     List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>>     List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>>    
>>
>> _______________________________________________
>> Wekalist mailing list
>> Send posts to: [hidden email]
>> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
>> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
>
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Loading...