On 3/06/12 7:25 AM, Armandosa wrote:
>
> I would like to use the Copy filter to double the attributes in my dataset
> (copy all the attributes).
> When I do it in the GUI, everything is fine.
> However when I use the code below, nothing happens:
>
> Instances pairedFormat;
> Copy pairFormatFilter = new Copy();
> pairFormatFilter.setInputFormat(dataset);
> int[] indices = new int[firstSet.numAttributes()];
> for(int i=0; i
> indices[i] = i+1;
> }
> pairFormatFilter.setAttributeIndicesArray(indices);
> pairFormatFilter.setInvertSelection(false);
> pairedFormat = Filter.useFilter(dataset, pairFormatFilter);
>
> I have also tried a String version using a Vector
. Another way I
> have used is to set the attribute array or string to be [] or "" and set the
> invert selection to true.
> Again no success. The pairedFormat still has attributes equal to the number
> of attributes of dataset.
>
> I think the problem is because I set input format to my dataset. But how
> else can I do this task?
> I have also tried changing the input format to a null pairedFormat.
You need to set the filter options before calling setInputFormat(). See
the examples at:
http://weka.wikispaces.com/Use+WEKA+in+your+Java+code#Filter
Cheers,
Mark.
_______________________________________________
Wekalist mailing list
Send posts to:
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
)