Re: Select columns weka wrapper

Peter Reutemann <[email protected]>
Newsgroups gmane.comp.ai.weka
Message-ID <CAHoQ12Lb10GY8ccXdGXpq+YTE6fMqAWQR2S0e383G9idgVkWxg@mail.gmail.com>
> I load an arff file like this
>
> dat = loader.load_file("vila_car_att.arff")
>
> However, I would like to select a given columns. I've tried:
>
> dat['lat']
>
> but I get this error:
>
> TypeError: 'Instances' object is not subscriptable

pww3 wraps the Weka API. The documentation for the Instances class is here:
http://fracpete.github.io/python-weka-wrapper3/weka.core.html#weka.core.dataset.Instances

> Any way of subsetting?

What are you trying to achieve? Creating subsets of columns? Then you
need to apply filters, e.g., the
weka.filters.unsupervised.attribute.Remove filter (use the -V flag to
invert which columns get removed).

Example usage:
http://fracpete.github.io/python-weka-wrapper3/examples.html

Repository with examples:
https://github.com/fracpete/python-weka-wrapper3-examples

Cheers, Peter
-- 
Peter Reutemann
Dept. of Computer Science
University of Waikato, NZ
+64 (7) 577-5304
http://www.cms.waikato.ac.nz/~fracpete/
http://www.data-mining.co.nz/
_______________________________________________
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.