Custom information in instances

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Custom information in instances

Alexander Osherenko
I wonder if it is possible to store custom information in Weka instances. I am aware of this post
http://weka.8497.n7.nabble.com/Resample-filter-loses-instance-comments-tc3142.html.

My input datasets are stored in ARFF files that have the @data section containing following line pairs:

%custom information of the instance stored as comment
feature values of the instance

If I use the standard ArffReader to read such ARFF file, all comments (useful information) are lost (I assume there is no special ArffReader that retains the comments).

There could be following solutions of this problem:
1. I can derive my own Instance class from standard Instance to store custom information in a member variable and derive my own ArffReader class from standard ArffReader to read such Arff-files. The problem -- all Weka functionality is lost while it works with standard Instances and not with my Instances;
2. I can add the string attribute to a dataset and store custom information in it. This is probably the best solution. However, I have to consider this new attribute and remove/restore this attribute if I, for example, classify a dataset since it would influence classification -- NaiveBayes doesn't work with string attributes.

Best, Alexander
Reply | Threaded
Open this post in threaded view
|

Re: Custom information in instances

Eibe Frank-2
Administrator

> On 10 Jun 2017, at 01:09, Alexander Osherenko <[hidden email]> wrote:
>
> 2. I can add the string attribute to a dataset and store custom information
> in it. This is probably the best solution. However, I have to consider this
> new attribute and remove/restore this attribute if I, for example, classify
> a dataset since it would influence classification -- NaiveBayes doesn't work
> with string attributes.

Yes, this is the best solution. Use the FilteredClassifier in conjunction with the Remove filter so that this extra attribute does not influence the classification.

Cheers,
Eibe


_______________________________________________
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