module mlmodel.piecewise_tree_regression_criterion_linear#

Short summary#

module mlinsights.mlmodel.piecewise_tree_regression_criterion_linear

Implements a custom criterion to train a decision tree.

source on GitHub

Classes#

class

truncated documentation

LinearRegressorCriterion

Criterion which computes the mean square error assuming points falling into one node are approximated by a line …

Documentation#

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

class mlinsights.mlmodel.piecewise_tree_regression_criterion_linear.LinearRegressorCriterion#

Bases: mlinsights.mlmodel._piecewise_tree_regression_common.CommonRegressorCriterion

Criterion which computes the mean square error assuming points falling into one node are approximated by a line (linear regression). The implementation follows the same design used in SimpleRegressorCriterion and is even slow as the criterion is more complex to compute.

__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)#
static create(DOUBLE_t[:, ::1] X, DOUBLE_t[:, ::1] y, DOUBLE_t[::1] sample_weight=None)#

Initializes the criterion.

Parameters
  • X – features

  • y – target

  • sample_weight – sample weight

Returns

an instance of LinearRegressorCriterion

node_beta(self, double[::1] dest)#

Stores the results of the linear regression in an allocated numpy array.

Parameters

dest – allocated array