Java Code Examples for org.dmg.pmml.tree.TreeModel#NoTrueChildStrategy
The following examples show how to use
org.dmg.pmml.tree.TreeModel#NoTrueChildStrategy .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RPartConverter.java From jpmml-r with GNU Affero General Public License v3.0 | 6 votes |
private TreeModel configureTreeModel(TreeModel treeModel){ TreeModel.NoTrueChildStrategy noTrueChildStrategy = TreeModel.NoTrueChildStrategy.RETURN_LAST_PREDICTION; TreeModel.MissingValueStrategy missingValueStrategy; switch(this.useSurrogate){ case 0: missingValueStrategy = TreeModel.MissingValueStrategy.NULL_PREDICTION; // XXX break; case 1: missingValueStrategy = TreeModel.MissingValueStrategy.LAST_PREDICTION; break; case 2: missingValueStrategy = null; break; default: throw new IllegalArgumentException(); } treeModel .setNoTrueChildStrategy(noTrueChildStrategy) .setMissingValueStrategy(missingValueStrategy); return treeModel; }
Example 2
Source File: TreeModelEvaluator.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 6 votes |
private Trail handleNoTrueChild(Trail trail){ TreeModel treeModel = getModel(); TreeModel.NoTrueChildStrategy noTrueChildStrategy = treeModel.getNoTrueChildStrategy(); switch(noTrueChildStrategy){ case RETURN_NULL_PREDICTION: return trail.selectNull(); case RETURN_LAST_PREDICTION: Node lastPrediction = trail.getLastPrediction(); // "Return the parent Node only if it specifies a score attribute" if(lastPrediction.hasScore()){ return trail.selectLastPrediction(); } return trail.selectNull(); default: throw new UnsupportedAttributeException(treeModel, noTrueChildStrategy); } }
Example 3
Source File: TreeModelCompactor.java From jpmml-lightgbm with GNU Affero General Public License v3.0 | 5 votes |
@Override public void enterTreeModel(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(); } }
Example 4
Source File: TreeModelCompactor.java From jpmml-sparkml with GNU Affero General Public License v3.0 | 5 votes |
@Override public void enterTreeModel(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(); } this.miningFunction = treeModel.getMiningFunction(); this.replacedPredicates.clear(); }
Example 5
Source File: TreeModelCompactor.java From jpmml-xgboost with GNU Affero General Public License v3.0 | 5 votes |
@Override public void enterTreeModel(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(); } }
Example 6
Source File: TreeModelCompactor.java From jpmml-sklearn with GNU Affero General Public License v3.0 | 5 votes |
@Override public void enterTreeModel(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(); } this.miningFunction = treeModel.getMiningFunction(); }
Example 7
Source File: RandomForestCompactor.java From jpmml-r with GNU Affero General Public License v3.0 | 5 votes |
@Override public void enterTreeModel(TreeModel treeModel){ TreeModel.NoTrueChildStrategy noTrueChildStrategy = treeModel.getNoTrueChildStrategy(); TreeModel.SplitCharacteristic splitCharacteristic = treeModel.getSplitCharacteristic(); if(!(TreeModel.NoTrueChildStrategy.RETURN_NULL_PREDICTION).equals(noTrueChildStrategy) || !(TreeModel.SplitCharacteristic.BINARY_SPLIT).equals(splitCharacteristic)){ throw new IllegalArgumentException(); } }
Example 8
Source File: NoTrueChildStrategyTest.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 3 votes |
private HasEntityId evaluate(TreeModel.NoTrueChildStrategy noTrueChildStrategy, Double value) throws Exception { TreeModelEvaluator evaluator = (TreeModelEvaluator)createModelEvaluator(); TreeModel treeModel = evaluator.getModel() .setNoTrueChildStrategy(noTrueChildStrategy); Map<FieldName, ?> arguments = createArguments("probability", value); Map<FieldName, ?> results = evaluator.evaluate(arguments); return (HasEntityId)results.get(evaluator.getTargetName()); }