Re: ArffFile

47 views
Skip to first unread message

Albert Bifet

unread,
Apr 27, 2016, 3:32:21 AM4/27/16
to MOA users
The problem may be in:

evaluateModel.learnerOption = learnerOption;

you need to set the parameters, not copy the option. Set the value of the option with setValue(String s) or setValueViaCLIString(String s).

Cheers, Albert

On Fri, Mar 18, 2016 at 1:30 PM, Natalia Mordvanyuk <natalia.m...@gmail.com> wrote:
Hello, everyone!
Somebody knows how to set to streamOption an ArffFile? My code is this:


             EvaluatePrequential evaluateModel = new EvaluatePrequential();

            ClassOption streamOption = new ClassOption("stream", 's',"C:\\Users\\PC\\Desktop\\inputs\\nominal\\s_1_opcio_2.arff", InstanceStream.class,"ArffFileStream","C:\\Users\\PC\\Desktop\\inputs\\nominal\\s_1_opcio_2.arff");
           
            //FileOption arffFileOption = new FileOption("arffFile", 'f', "C:\\Users\\PC\\Desktop\\inputs\\nominal\\s_1_opcio_2.arff", null, "arff", true);
           
            ClassOption learnerOption = new ClassOption("learner", 'l',"Classifier to train", Classifier.class, "bayes.NaiveBayes");
        
            ClassOption evaluatorOption = new ClassOption("evaluator", 'e',"Classification performance evaluation method.",ClassificationPerformanceEvaluator.class,"WindowClassificationPerformanceEvaluator");
    
            IntOption sampleFrequencyOption = new IntOption("sampleFrequency",'f',"How many instances between samples of the learning performance.",1, 0, Integer.MAX_VALUE);   
          
            evaluateModel.learnerOption = learnerOption;
            evaluateModel.streamOption = streamOption;
            evaluateModel.evaluatorOption = evaluatorOption;
            evaluateModel.sampleFrequencyOption = sampleFrequencyOption;
           
            LearningEvaluation evaluation = (LearningEvaluation) evaluateModel.doTask();

            HashMap<String, Double> mesures = extreureMesures(evaluation);
            double precision = mesures.get("classifications correct (percent)");
            //extraer Kappa etc...


And my error is related to the arff file, that is null:

Exception in thread "main" java.lang.NullPointerException
    at moa.options.AbstractOptionHandler.prepareClassOptions(AbstractOptionHandler.java:147)
    at moa.options.AbstractOptionHandler.prepareForUse(AbstractOptionHandler.java:76)
    at moaexample.MOAApplicationExample.main(MOAApplicationExample.java:93)
Java Result: 1

So, ClassOption streamOption = new ClassOption("stream", 's',"C:\\Users\\PC\\Desktop\\inputs\\nominal\\s_1_opcio_2.arff", InstanceStream.class,"ArffFileStream","C:\\Users\\PC\\Desktop\\inputs\\nominal\\s_1_opcio_2.arff");
should be done different.

I hope that somebody will be able to help me.

Thanks,
Natalia.


--
You received this message because you are subscribed to the Google Groups "MOA users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to moa-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages