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