本文整理汇总了Java中org.dmg.pmml.tree.TreeModel.MissingValueStrategy方法的典型用法代码示例。如果您正苦于以下问题:Java TreeModel.MissingValueStrategy方法的具体用法?Java TreeModel.MissingValueStrategy怎么用?Java TreeModel.MissingValueStrategy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.dmg.pmml.tree.TreeModel
的用法示例。
在下文中一共展示了TreeModel.MissingValueStrategy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.dmg.pmml.tree.TreeModel; //导入方法依赖的package包/类
@Override
public VisitorAction visit(TreeModel treeModel){
TreeModel.MissingValueStrategy missingValueStrategy = treeModel.getMissingValueStrategy();
TreeModel.NoTrueChildStrategy noTrueChildStrategy = treeModel.getNoTrueChildStrategy();
TreeModel.SplitCharacteristic splitCharacteristic = treeModel.getSplitCharacteristic();
if(!(TreeModel.MissingValueStrategy.DEFAULT_CHILD).equals(missingValueStrategy) || !(TreeModel.NoTrueChildStrategy.RETURN_NULL_PREDICTION).equals(noTrueChildStrategy) || !(TreeModel.SplitCharacteristic.BINARY_SPLIT).equals(splitCharacteristic)){
throw new IllegalArgumentException();
}
treeModel
.setMissingValueStrategy(TreeModel.MissingValueStrategy.NONE)
.setNoTrueChildStrategy(TreeModel.NoTrueChildStrategy.RETURN_LAST_PREDICTION)
.setSplitCharacteristic(TreeModel.SplitCharacteristic.MULTI_SPLIT);
return super.visit(treeModel);
}
示例2: handleMissingValue
import org.dmg.pmml.tree.TreeModel; //导入方法依赖的package包/类
/**
* @param parent The parent Node of the Node that evaluated to the missing value.
* @param node The Node that evaluated to the missing value.
*/
private Trail handleMissingValue(Trail trail, Node parent, Node node, EvaluationContext context){
TreeModel treeModel = getModel();
TreeModel.MissingValueStrategy missingValueStrategy = treeModel.getMissingValueStrategy();
switch(missingValueStrategy){
case NULL_PREDICTION:
return trail.selectNull();
case LAST_PREDICTION:
return trail.selectLastPrediction();
case DEFAULT_CHILD:
return handleDefaultChild(trail, parent, context);
case NONE:
return null;
default:
throw new UnsupportedAttributeException(treeModel, missingValueStrategy);
}
}
示例3: visit
import org.dmg.pmml.tree.TreeModel; //导入方法依赖的package包/类
@Override
public VisitorAction visit(TreeModel treeModel){
TreeModel.MissingValueStrategy missingValueStrategy = treeModel.getMissingValueStrategy();
TreeModel.NoTrueChildStrategy noTrueChildStrategy = treeModel.getNoTrueChildStrategy();
TreeModel.SplitCharacteristic splitCharacteristic = treeModel.getSplitCharacteristic();
if(!(TreeModel.MissingValueStrategy.NONE).equals(missingValueStrategy) || !(TreeModel.NoTrueChildStrategy.RETURN_NULL_PREDICTION).equals(noTrueChildStrategy) || !(TreeModel.SplitCharacteristic.BINARY_SPLIT).equals(splitCharacteristic)){
throw new IllegalArgumentException();
}
treeModel
.setMissingValueStrategy(TreeModel.MissingValueStrategy.NULL_PREDICTION)
.setSplitCharacteristic(TreeModel.SplitCharacteristic.MULTI_SPLIT);
MiningFunction miningFunction = treeModel.getMiningFunction();
switch(miningFunction){
case REGRESSION:
treeModel.setNoTrueChildStrategy(TreeModel.NoTrueChildStrategy.RETURN_LAST_PREDICTION);
break;
case CLASSIFICATION:
break;
default:
throw new IllegalArgumentException();
}
return super.visit(treeModel);
}
示例4: visit
import org.dmg.pmml.tree.TreeModel; //导入方法依赖的package包/类
@Override
public VisitorAction visit(TreeModel treeModel){
TreeModel.MissingValueStrategy missingValueStrategy = treeModel.getMissingValueStrategy();
switch(missingValueStrategy){
case AGGREGATE_NODES:
case WEIGHTED_CONFIDENCE:
report(new UnsupportedAttributeException(treeModel, missingValueStrategy));
break;
default:
break;
}
return super.visit(treeModel);
}
示例5: evaluate
import org.dmg.pmml.tree.TreeModel; //导入方法依赖的package包/类
private NodeScoreDistribution<?> evaluate(TreeModel.MissingValueStrategy missingValueStrategy, Double missingValuePenalty, Map<FieldName, ?> arguments) throws Exception {
TreeModelEvaluator evaluator = (TreeModelEvaluator)createModelEvaluator();
TreeModel treeModel = evaluator.getModel()
.setMissingValueStrategy(missingValueStrategy)
.setMissingValuePenalty(missingValuePenalty);
Map<FieldName, ?> result = evaluator.evaluate(arguments);
return (NodeScoreDistribution<?>)result.get(evaluator.getTargetFieldName());
}