我需要通过java代码为Weka网格搜索设置评估标准。我添加了以下代码。但它没有用。
int EVALUATION_CC = 0;
int EVALUATION_RMSE = 1;
int EVALUATION_RRSE = 2;
int EVALUATION_MAE = 3;
int EVALUATION_RAE = 4;
int EVALUATION_COMBINED = 5;
int EVALUATION_ACC = 6;
int EVALUATION_KAPPA = 7;
Tag[] TAGS_EVALUATION = {
new Tag(EVALUATION_CC, "CC", "Correlation coefficient"),
new Tag(EVALUATION_RMSE, "RMSE", "Root mean squared error"),
new Tag(EVALUATION_RRSE, "RRSE", "Root relative squared error"),
new Tag(EVALUATION_MAE, "MAE", "Mean absolute error"),
new Tag(EVALUATION_RAE, "RAE", "Root absolute error"),
new Tag(EVALUATION_COMBINED, "COMB", "Combined = (1-abs(CC)) + RRSE + RAE"),
new Tag(EVALUATION_ACC, "ACC", "Accuracy"),
new Tag(EVALUATION_KAPPA, "KAP", "Kappa")
};
SelectedTag st=new SelectedTag(EVALUATION_ACC, TAGS_EVALUATION);
GridSearch gs = new GridSearch();
gs.setEvaluation(st);
任何人都可以告诉我该怎么做?
答案 0 :(得分:2)
检查一下,
GridSearch gs = new GridSearch();
int requiredIndex = 6; // for accuracy
SelectedTag st=new SelectedTag(requiredIndex , weka.classifiers.meta.GridSearch.TAGS_EVALUATION);
gs.setEvaluation(st);
答案 1 :(得分:1)
我有同样的问题,但最终我得到了它,使用这个:
int waucIndex = 8;
SelectedTag st=new SelectedTag(waucIndex , weka.classifiers.meta.GridSearch.TAGS_EVALUATION);
search.setEvaluation(st);
您可以通过执行以下操作验证是否已正确设置:
System.out.println(search.getEvaluation());