【问题标题】:How to set evaluation criteria of Weka grid search through java code如何通过java代码设置Weka网格搜索的评价标准
【发布时间】:2014-12-29 08:15:36
【问题描述】:

我需要通过 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);

谁能告诉我怎么做?

【问题讨论】:

  • 可以说什么不工作?它运行吗?你有错误吗?你不喜欢它做什么?
  • 它正在运行且没有错误。但网格搜索仍然使用其默认评估标准(CC-相关系数)

标签: java classification weka document-classification


【解决方案1】:

检查一下,

GridSearch gs = new GridSearch(); 
int requiredIndex = 6; // for accuracy
SelectedTag st=new SelectedTag(requiredIndex , weka.classifiers.meta.GridSearch.TAGS_EVALUATION);
gs.setEvaluation(st);

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,但最终我得到了它,使用这个:

    int waucIndex = 8;
    SelectedTag st=new SelectedTag(waucIndex , weka.classifiers.meta.GridSearch.TAGS_EVALUATION);
    search.setEvaluation(st);
    

    您可以通过以下方式验证它是否设置正确:

    System.out.println(search.getEvaluation());
    

    【讨论】:

      猜你喜欢
      • 2014-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-16
      • 1970-01-01
      • 2021-11-23
      相关资源
      最近更新 更多