ReplaceMissingValues filter from java code

View: New views
2 Messages — Rating Filter:   Alert me  

ReplaceMissingValues filter from java code

by Mohamad El Abed :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello,

I want to use "ReplaceMissingValues" from code. But i have this error:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 63
    at
weka.filters.unsupervised.attribute.ReplaceMissingValues.batchFinished(Unknown
Source)
    at weka.filters.Filter.useFilter(Unknown Source)
    at Imp_Interface1.classification(Imp_Interface1.java:368)
    at Exec.main(Exec.java:18)


My code is:

//declaration of the filter
ReplaceMissingValues x= new ReplaceMissingValues();
   
    x.setInputFormat(dataset);

//filter the dataset
    Instances newdata = Filter.useFilter(dataset, x);



Thanks for any help!




_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
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

Re: ReplaceMissingValues filter from java code

by Peter Reutemann-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> I want to use "ReplaceMissingValues" from code. But i have this error:
>
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 63
>   at
> weka.filters.unsupervised.attribute.ReplaceMissingValues.batchFinished(Unknown
> Source)
>   at weka.filters.Filter.useFilter(Unknown Source)
>   at Imp_Interface1.classification(Imp_Interface1.java:368)
>   at Exec.main(Exec.java:18)
>
>
> My code is:
>
> //declaration of the filter
> ReplaceMissingValues x= new ReplaceMissingValues();
>     x.setInputFormat(dataset);
>
> //filter the dataset
>   Instances newdata = Filter.useFilter(dataset, x);

The ReplaceMissingValues is a very common filter. It's hard to believe
that it still contains bugs.

Anyway... What version of Weka are you using? What dataset were you
using? Maybe your dataset is screwed, e.g., when assembling the
weka.core.Instances object incorrectly by hand? Can you output the
dataset via following code snippet without any problems?
   System.out.println(dataset);

Cheers, Peter
--
Peter Reutemann, Dept. of Computer Science, University of Waikato, NZ
http://www.cs.waikato.ac.nz/~fracpete/           Ph. +64 (7) 858-5174

_______________________________________________
Wekalist mailing list
Send posts to: Wekalist@...
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