[英]How to set evaluation criteria of Weka grid search through java code
我需要通過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);
誰能告訴我該怎么做?
檢查一下
GridSearch gs = new GridSearch();
int requiredIndex = 6; // for accuracy
SelectedTag st=new SelectedTag(requiredIndex , weka.classifiers.meta.GridSearch.TAGS_EVALUATION);
gs.setEvaluation(st);
我遇到了同樣的問題,但最終我使用了以下方法使其工作:
int waucIndex = 8;
SelectedTag st=new SelectedTag(waucIndex , weka.classifiers.meta.GridSearch.TAGS_EVALUATION);
search.setEvaluation(st);
您可以通過執行以下操作來驗證其設置是否正確:
System.out.println(search.getEvaluation());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.