@Test public void evaluateRegressionDefault(){ TargetValue targetValue = new TargetValue() .setDefaultValue(Math.PI); Target target = new Target() .setField(null) .addTargetValues(targetValue); ModelEvaluator<?> evaluator = createTreeModelEvaluator(MiningFunction.REGRESSION, MathContext.FLOAT, target); DataField dataField = evaluator.getDataField(target.getField()); assertEquals(OpType.CONTINUOUS, dataField.getOpType()); assertEquals(DataType.FLOAT, dataField.getDataType()); Map<FieldName, ?> results = evaluator.evaluate(Collections.emptyMap()); assertEquals((float)Math.PI, results.get(dataField.getName())); evaluator = createTreeModelEvaluator(MiningFunction.REGRESSION, MathContext.DOUBLE, target); dataField = evaluator.getDefaultDataField(); assertEquals(OpType.CONTINUOUS, dataField.getOpType()); assertEquals(DataType.DOUBLE, dataField.getDataType()); results = evaluator.evaluate(Collections.emptyMap()); assertEquals(Math.PI, results.get(dataField.getName())); }
static public <V extends Number> Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField){ Target target = targetField.getTarget(); if(target != null && target.hasTargetValues()){ Value<V> value = getDefaultValue(valueFactory, target); if(value != null){ return evaluateRegression(targetField, value); } } return Collections.singletonMap(targetField.getFieldName(), null); }
TargetUtil { static public <V extends Number> Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField){ Target target = targetField.getTarget(); if(target != null && target.hasTargetValues()){ Value<V> value = getDefaultValue(valueFactory, target); if(value != null){ return evaluateRegression(targetField, value); } } return Collections.singletonMap(targetField.getFieldName(), null); } }
TargetUtil { static public <V extends Number> Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField){ Target target = targetField.getTarget(); if(target != null && target.hasTargetValues()){ Value<V> value = getDefaultValue(valueFactory, target); if(value != null){ return evaluateRegression(targetField, value); } } return Collections.singletonMap(targetField.getFieldName(), null); } private  TargetUtil(); }
TargetUtil { static public <V extends Number> Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField){ Target target = targetField.getTarget(); if(target != null && target.hasTargetValues()){ Value<V> value = getDefaultValue(valueFactory, target); if(value != null){ return evaluateRegression(targetField, value); } } return Collections.singletonMap(targetField.getFieldName(), null); } private  TargetUtil(); static void computeResult(DataType dataType, Regression<?> regression); static void computeResult(DataType dataType, Classification<?, ?> classification); static void computeResult(DataType dataType, Vote vote); static Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField); static Map<FieldName, ?> evaluateRegression(TargetField targetField, Value<V> value); static Map<FieldName, ? extends Regression<V>> evaluateRegression(TargetField targetField, Regression<V> regression); static Value<V> evaluateRegressionInternal(TargetField targetField, Value<V> value); static Map<FieldName, ? extends Vote> evaluateVote(TargetField targetField, Vote vote); static Map<FieldName, ? extends Classification<?, V>> evaluateClassificationDefault(ValueFactory<V> valueFactory, TargetField targetField); static Map<FieldName, ? extends Classification<?, V>> evaluateClassification(TargetField targetField, Classification<?, V> classification); static Value<V> processValue(Target target, Value<V> value); static TargetValue getTargetValue(Target target, Object value); }
TargetUtil { static public <V extends Number> Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField){ Target target = targetField.getTarget(); if(target != null && target.hasTargetValues()){ Value<V> value = getDefaultValue(valueFactory, target); if(value != null){ return evaluateRegression(targetField, value); } } return Collections.singletonMap(targetField.getFieldName(), null); } private  TargetUtil(); static void computeResult(DataType dataType, Regression<?> regression); static void computeResult(DataType dataType, Classification<?, ?> classification); static void computeResult(DataType dataType, Vote vote); static Map<FieldName, ?> evaluateRegressionDefault(ValueFactory<V> valueFactory, TargetField targetField); static Map<FieldName, ?> evaluateRegression(TargetField targetField, Value<V> value); static Map<FieldName, ? extends Regression<V>> evaluateRegression(TargetField targetField, Regression<V> regression); static Value<V> evaluateRegressionInternal(TargetField targetField, Value<V> value); static Map<FieldName, ? extends Vote> evaluateVote(TargetField targetField, Vote vote); static Map<FieldName, ? extends Classification<?, V>> evaluateClassificationDefault(ValueFactory<V> valueFactory, TargetField targetField); static Map<FieldName, ? extends Classification<?, V>> evaluateClassification(TargetField targetField, Classification<?, V> classification); static Value<V> processValue(Target target, Value<V> value); static TargetValue getTargetValue(Target target, Object value);  }