Massive online analysis in Netbeans: unable to access environment with tools

I am trying to run the Massive Online Analysis (MOA) demo code in Netbeans. Here is the code:

package javaapplication10_moa;

import moa.classifiers.trees.HoeffdingTree;
import moa.classifiers.Classifier;
import moa.core.TimingUtils;
import moa.streams.generators.RandomRBFGenerator;
import com.yahoo.labs.samoa.instances.Instance;
import java.io.IOException;


/**
 *
 * @author LENOVO
 */
public class JavaApplication10_MOA {

        public JavaApplication10_MOA(){            
        }

        public void run(int numInstances, boolean isTesting){
                Classifier learner = new HoeffdingTree();
                RandomRBFGenerator stream = new RandomRBFGenerator();
                stream.prepareForUse();

                learner.setModelContext(stream.getHeader());
                learner.prepareForUse();

                int numberSamplesCorrect = 0;
                int numberSamples = 0;
                boolean preciseCPUTiming = TimingUtils.enablePreciseTiming();
                long evaluateStartTime = TimingUtils.getNanoCPUTimeOfCurrentThread();
                while (stream.hasMoreInstances() && numberSamples < numInstances) {
                        Instance trainInst = stream.nextInstance().getData();
                        if (isTesting) {
                                if (learner.correctlyClassifies(trainInst)){
                                        numberSamplesCorrect++;
                                }
                        }
                        numberSamples++;
                        learner.trainOnInstance(trainInst);
                }
                double accuracy = 100.0 * (double) numberSamplesCorrect/ (double) numberSamples;
                double time = TimingUtils.nanoTimeToSeconds(TimingUtils.getNanoCPUTimeOfCurrentThread()- evaluateStartTime);
                System.out.println(numberSamples + " instances processed with " + accuracy + "% accuracy in "+time+" seconds.");
        }        

        public static void main(String[] args) throws IOException {
                JavaApplication10_MOA exp = new JavaApplication10_MOA();
                exp.run(1000000, true);
        } 

}

And here is the conclusion:

Unable to access tools environment. Check if there is a jar file containing the SizeOfAgent class; the java "-javaagent" command line argument is specified. 1,000,000 copies processed with 91.0458% accuracy in 5.5 seconds. BUILD SUCCESSFUL (total time: 5 seconds)

, Netbeans , . Netbeans Java, "" → " " → "". -javaagent: sizeofag.jar. !:( , , .

+4
1

java- Project->Properties->Run->VM :

-javaagent:"<full path to jar>/target.jar"

, netbens javaagent NetBeans, .

PS: , example

BTW moa-release-2016.04.zip, , java Netbeans, <path>/moa-release-2016.04/lib/moa-2016.04.jar "" - . javaagent Run. :

run:
1000000 instances processed with 91.0458% accuracy in 5.480392592 seconds.
BUILD SUCCESSFUL (total time: 5 seconds)
0

Source: https://habr.com/ru/post/1680960/


All Articles