module mlmodel._piecewise_tree_regression_common#

Short summary#

module mlinsights.mlmodel._piecewise_tree_regression_common

Implements a custom criterion to train a decision tree.

source on GitHub

Classes#

class

truncated documentation

CommonRegressorCriterion

Common class to implement various version of mean square error. …

Functions#

function

truncated documentation

_test_criterion_check

_test_criterion_check(Criterion criterion)

_test_criterion_impurity_improvement

_test_criterion_impurity_improvement(Criterion criterion, double impurity_parent, double impurity_left, double impurity_right) …

_test_criterion_init

_test_criterion_init(Criterion criterion, const DOUBLE_t[:,

_test_criterion_node_impurity

_test_criterion_node_impurity(Criterion criterion) Test purposes. Methods cannot be directly called from python.

_test_criterion_node_impurity_children

_test_criterion_node_impurity_children(Criterion criterion) Test purposes. Methods cannot be directly called from python. …

_test_criterion_node_value

_test_criterion_node_value(Criterion criterion) Test purposes. Methods cannot be directly called from python.

_test_criterion_printf

_test_criterion_printf(Criterion crit) Test purposes. Methods cannot be directly called from python.

_test_criterion_proxy_impurity_improvement

_test_criterion_proxy_impurity_improvement(Criterion criterion) Test purposes. Methods cannot be directly called from python. …

_test_criterion_update

_test_criterion_update(Criterion criterion, SIZE_t new_pos) Test purposes. Methods cannot be directly called from python. …

assert_criterion_equal

assert_criterion_equal(Criterion c1, Criterion c2)

Documentation#

@file @brief Implements a custom criterion to train a decision tree.

class mlinsights.mlmodel._piecewise_tree_regression_common.CommonRegressorCriterion#

Bases: Criterion

Common class to implement various version of mean square error. The code was inspired from hellinger_distance_criterion.pyx, Cython example of exposing C-computed arrays in Python without data copies, _criterion.pyx. This implementation is not efficient but was made that way on purpose. It adds the features to the class.

If the file does not compile, some explanations are given in :ref:`scikit-learn internal API <blog-internal-api-impurity-improvement>`_.

__deepcopy__(self, memo=None)#

This does not a copy but mostly creates a new instance of the same criterion initialized with the same data.

__getstate__(self)#
__new__(**kwargs)#
__pyx_vtable__ = <capsule object NULL>#
__reduce_cython__(self)#
__setstate__(self, d)#
__setstate_cython__(self, __pyx_state)#
mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_check(Criterion criterion)#
mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_impurity_improvement(Criterion criterion, double impurity_parent, double impurity_left, double impurity_right)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_init(Criterion criterion, const DOUBLE_t[:, ::1] y, DOUBLE_t[:] sample_weight, double weighted_n_samples, SIZE_t[:] samples, SIZE_t start, SIZE_t end)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_node_impurity(Criterion criterion)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_node_impurity_children(Criterion criterion)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_node_value(Criterion criterion)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_printf(Criterion crit)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_proxy_impurity_improvement(Criterion criterion)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common._test_criterion_update(Criterion criterion, SIZE_t new_pos)#

Test purposes. Methods cannot be directly called from python.

mlinsights.mlmodel._piecewise_tree_regression_common.assert_criterion_equal(Criterion c1, Criterion c2)#