Java Code Examples for org.dmg.pmml.tree.TreeModel#getMiningFunction()

The following examples show how to use org.dmg.pmml.tree.TreeModel#getMiningFunction() . 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: TargetCategoryParser.java    From jpmml-evaluator with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public VisitorAction visit(Node node){
	PMMLObject parent = getParent();

	if(parent instanceof TreeModel){
		TreeModel treeModel = (TreeModel)parent;

		MiningFunction miningFunction = treeModel.getMiningFunction();
		switch(miningFunction){
			case CLASSIFICATION:
				break;
			default:
				return VisitorAction.SKIP;
		}
	}

	node.setScore(parseTargetValue(node.getScore()));

	return super.visit(node);
}
 
Example 2
Source File: NodeScoreParser.java    From jpmml-evaluator with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public VisitorAction visit(TreeModel treeModel){
	MiningFunction miningFunction = treeModel.getMiningFunction();
	if(miningFunction == null){
		throw new MissingAttributeException(treeModel, PMMLAttributes.TREEMODEL_MININGFUNCTION);
	}

	switch(miningFunction){
		case REGRESSION:
			break;
		default:
			return VisitorAction.SKIP;
	}

	return super.visit(treeModel);
}
 
Example 3
Source File: TreeModelCompactor.java    From jpmml-sparkml with GNU Affero General Public License v3.0 5 votes vote down vote up
@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 4
Source File: TreeModelCompactor.java    From jpmml-sklearn with GNU Affero General Public License v3.0 5 votes vote down vote up
@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 5
Source File: ModelManagerFactoryTest.java    From jpmml-evaluator with GNU Affero General Public License v3.0 5 votes vote down vote up
public RegressorManager(PMML pmml, TreeModel treeModel){
	super(pmml, treeModel);

	MiningFunction miningFunction = treeModel.getMiningFunction();
	switch(miningFunction){
		case REGRESSION:
			break;
		default:
			throw new UnsupportedAttributeException(treeModel, miningFunction);
	}
}
 
Example 6
Source File: ModelManagerFactoryTest.java    From jpmml-evaluator with GNU Affero General Public License v3.0 5 votes vote down vote up
public ClassifierManager(PMML pmml, TreeModel treeModel){
	super(pmml, treeModel);

	MiningFunction miningFunction = treeModel.getMiningFunction();
	switch(miningFunction){
		case CLASSIFICATION:
			break;
		default:
			throw new UnsupportedAttributeException(treeModel, miningFunction);
	}
}
 
Example 7
Source File: TreeModelFlattener.java    From jpmml-sklearn with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void enterTreeModel(TreeModel treeModel){
	this.miningFunction = treeModel.getMiningFunction();
}