Пример #1
0
  public static Parameter getSVMParamter() {
    Parameter param =
        new Parameter(SolverType.L2R_L2LOSS_SVC_DUAL, 1, Double.POSITIVE_INFINITY, 0.1);

    if (param.getEps() == Double.POSITIVE_INFINITY) {
      switch (param.getSolverType()) {
        case L2R_LR:
        case L2R_L2LOSS_SVC:
          param.setEps(0.01);
          break;
        case L2R_L2LOSS_SVR:
          param.setEps(0.001);
          break;
        case L2R_L2LOSS_SVC_DUAL:
        case L2R_L1LOSS_SVC_DUAL:
        case MCSVM_CS:
        case L2R_LR_DUAL:
          param.setEps(0.1);
          break;
        case L1R_L2LOSS_SVC:
        case L1R_LR:
          param.setEps(0.01);
          break;
        case L2R_L1LOSS_SVR_DUAL:
        case L2R_L2LOSS_SVR_DUAL:
          param.setEps(0.1);
          break;
        default:
          throw new IllegalStateException("unknown solver type: " + param.getSolverType());
      }
    }

    return param;
  }
Пример #2
0
  public Parameter getParamsCopy() {
    Parameter p2 = new Parameter(params.getSolverType(), params.getC(), params.getEps());
    if (weights != null) {
      p2.setWeights(params.getWeights(), params.getWeightLabels());
    }
    p2.setEps(params.getEps());

    return p2;
  }
Пример #3
0
 public void setWeights(double[] weights) {
   this.weights = weights;
   params.setWeights(weights, weightLabels);
   doWeightLabels = true;
 }
Пример #4
0
 public void setEps(double eps) {
   this.eps = eps;
   params.setEps(eps);
 }