labeling an unlabeled instance in Weka(java code) -


i beginner in java , weka tool, want use logitboost algorithm decisionstump weak learner in java code, don't know how work. create vector 6 feature(without label feature) , want feed logitboost labeling , probability of assignment. labels 1 or -1 , train/test data in arff file.this code, algorithm return 0 ! thanks

double candidate_similarity(ha_nodes ha , weightmatrix[][] wm , logitboost lgb ,arraylist<attribute> atts){        logitboost lgb = new logitboost();        lgb.buildclassifier(newdata);//newdata arff file labeled data        evaluation eval = new evaluation(newdata);        eval.crossvalidatemodel(lgb, newdata, 10, new random(1));        try {             feature_vector[0] = ip_sim(main.a_new.dip, ha.candidate.dip_cand);              feature_vector[1] = ip_sim(main.a_new.sip, ha.candidate.sip_cand);              feature_vector[2] = ip_s_d_sim(main.a_new.sip, ha);              feature_vector[3] = dport_sim(main.a_new.dport, ha);             freq_weight(main.a_new.atype, ha, freq_avg, weight_avg , wm);             feature_vector[4] = weight_avg;             feature_vector[5] = freq_avg;             double[] values = new double[]{feature_vector[0],feature_vector[1],feature_vector[2],feature_vector[3],feature_vector[4],feature_vector[5]};             denseinstance newinst = new denseinstance(1.0,values);             instances dataunlabeled = new instances("testinstances", atts, 0);             dataunlabeled.add(newinst);             dataunlabeled.setclassindex(dataunlabeled.numattributes() - 1);             double clslable = lgb.classifyinstance(inst);         } catch (exception ex) {             //logger.getlogger(module2.class.getname()).log(level.severe, null, ex);         }         return clslable;} 

where did newdata come from? need load file correct classification, use class load features file: http://weka.sourceforge.net/doc/weka/core/converters/arffloader.html

i'm not posting example code because use weka matlab, dont have examples in java.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -