sklearn_pmml_model.tree
#
The sklearn_pmml_model.tree
module includes decision tree-based models for
classification and regression.
Submodules#
Package Contents#
Classes#
A decision tree classifier. |
|
A decision tree regressor. |
Functions#
|
Construct a single tree for a <Segment> PMML element. |
|
Clone a DecisionTree, including private properties that are ignored in sklearn.base.clone. |
- class sklearn_pmml_model.tree.PMMLTreeClassifier(pmml)#
Bases:
sklearn_pmml_model.base.PMMLBaseClassifier
,sklearn.tree.DecisionTreeClassifier
A decision tree classifier.
The PMML model consists out of a <TreeModel> element, containing at least one <Node> element. Every node element contains a predicate, and optional <Node> children. Leaf nodes either have a score attribute or <ScoreDistribution> child describing the classification output.
- Parameters:
- pmmlstr, object
Filename or file object containing PMML data.
Notes
Specification: http://dmg.org/pmml/v4-3/TreeModel.html
- fit(x, y)#
Not supported: PMML models are already fitted.
- _more_tags()#
- class sklearn_pmml_model.tree.PMMLTreeRegressor(pmml)#
Bases:
sklearn_pmml_model.base.PMMLBaseRegressor
,sklearn.tree.DecisionTreeRegressor
A decision tree regressor.
The PMML model consists out of a <TreeModel> element, containing at least one <Node> element. Every node element contains a predicate, and optional <Node> children. Leaf nodes either have a score attribute or <ScoreDistribution> child describing the classification output.
- Parameters:
- pmmlstr, object
Filename or file object containing PMML data.
Notes
Specification: http://dmg.org/pmml/v4-3/TreeModel.html
- fit(x, y)#
Not supported: PMML models are already fitted.
- _more_tags()#
- sklearn_pmml_model.tree.get_tree(est, segment, rescale_factor=1) object #
Construct a single tree for a <Segment> PMML element.
- Parameters:
- est:
The estimator to built the tree for. Should contain template_estimator and field_mapping attributes.
- segmenteTree.Element
<Segment> element containing the decision tree to be imported. Only segments with a <True/> predicate are supported.
- rescale_factorfloat
Factor to scale the output of every node with. Required for gradient boosting trees. Optional, and 1 by default.
- Returns:
- treesklearn.tree.DecisionTreeClassifier, sklearn.tree.DecisionTreeRegressor
The sklearn decision tree instance imported from the provided segment, matching the type specified in est.template_estimator.
- sklearn_pmml_model.tree.clone(est, safe=True)#
Clone a DecisionTree, including private properties that are ignored in sklearn.base.clone.
- Parameters:
- estBaseEstimator
The estimator or group of estimators to be cloned.
- safeboolean, optional
If safe is false, clone will fall back to a deep copy on objects that are not estimators.