I'm trying to run some demo code of Massive Online Analysis (MOA) 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 output:
Can not access instrumentation environment. Please check if jar file containing SizeOfAgent class is specified in the java's "-javaagent" command line argument. 1000000 instances processed with 91.0458% accuracy in 5.5 seconds. BUILD SUCCESSFUL (total time: 5 seconds)
The thing is Netbeans was unable to access instrumentation environment, which I understand to be something similar to a profile. I have tried the suggestions from Netbeans how to set command line arguments in Java, by going to Run -> Set Project Configuration -> Customize. Set Arguments to -javaagent:sizeofag.jar . Yet it does not work! :( Please help me, thank you very much