@Override
  public Map<FieldName, ?> evaluate(ModelEvaluationContext context) {
    SupportVectorMachineModel supportVectorMachineModel = getModel();
    if (!supportVectorMachineModel.isScorable()) {
      throw new InvalidResultException(supportVectorMachineModel);
    }

    SvmRepresentationType svmRepresentation = supportVectorMachineModel.getSvmRepresentation();
    switch (svmRepresentation) {
      case SUPPORT_VECTORS:
        break;
      default:
        throw new UnsupportedFeatureException(supportVectorMachineModel, svmRepresentation);
    }

    Map<FieldName, ?> predictions;

    MiningFunctionType miningFunction = supportVectorMachineModel.getFunctionName();
    switch (miningFunction) {
      case REGRESSION:
        predictions = evaluateRegression(context);
        break;
      case CLASSIFICATION:
        predictions = evaluateClassification(context);
        break;
      default:
        throw new UnsupportedFeatureException(supportVectorMachineModel, miningFunction);
    }

    return OutputUtil.evaluate(predictions, context);
  }
예제 #2
0
  @Override
  public Map<FieldName, ?> evaluate(ModelEvaluationContext context) {
    TreeModel treeModel = getModel();
    if (!treeModel.isScorable()) {
      throw new InvalidResultException(treeModel);
    }

    Map<FieldName, ?> predictions;

    MiningFunction miningFunction = treeModel.getMiningFunction();
    switch (miningFunction) {
      case REGRESSION:
        predictions = evaluateRegression(context);
        break;
      case CLASSIFICATION:
        predictions = evaluateClassification(context);
        break;
      default:
        throw new UnsupportedFeatureException(treeModel, miningFunction);
    }

    return OutputUtil.evaluate(predictions, context);
  }
예제 #3
0
  @Override
  public Map<FieldName, ?> evaluate(Map<FieldName, ?> arguments) {
    RuleSetModel ruleSetModel = getModel();
    if (!ruleSetModel.isScorable()) {
      throw new InvalidResultException(ruleSetModel);
    }

    Map<FieldName, ?> predictions;

    ModelManagerEvaluationContext context = new ModelManagerEvaluationContext(this);
    context.pushFrame(arguments);

    MiningFunctionType miningFunction = ruleSetModel.getFunctionName();
    switch (miningFunction) {
      case CLASSIFICATION:
        predictions = evaluateRuleSet(context);
        break;
      default:
        throw new UnsupportedFeatureException(ruleSetModel, miningFunction);
    }

    return OutputUtil.evaluate(predictions, context);
  }