Skip to content

Splitter

Base class for the tree splitters.

Each Attribute Observer (AO) or Splitter monitors one input feature and finds the best split point for this attribute. AOs can also perform other tasks related to the monitored feature, such as estimating its probability density function (classification case).

This class should not be instantiated, as none of its methods are implemented.

Attributes

  • is_numeric

    Determine whether or not the splitter works with numerical features.

  • is_target_class

    Check on which kind of learning task the splitter is designed to work. If True, the splitter works with classification trees, otherwise it is designed for regression trees.

Methods

best_evaluated_split_suggestion

Get the best split suggestion given a criterion and the target's statistics.

Parameters

  • criterion (river.tree.split_criterion.base.SplitCriterion)
  • pre_split_dist (Union[List, Dict])
  • att_idx (Hashable)
  • binary_only (bool)

Returns

BranchFactory: Suggestion of the best attribute split.

clone

Return a fresh estimator with the same parameters.

The clone has the same parameters but has not been updated with any data. This works by looking at the parameters from the class signature. Each parameter is either - recursively cloned if it's a River classes. - deep-copied via copy.deepcopy if not. If the calling object is stochastic (i.e. it accepts a seed parameter) and has not been seeded, then the clone will not be idempotent. Indeed, this method's purpose if simply to return a new instance with the same input parameters.

cond_proba

Get the probability for an attribute value given a class.

Parameters

  • att_val
  • target_val (Union[bool, str, int])

Returns

float: Probability for an attribute value given a class.

update

Update statistics of this observer given an attribute value, its target value and the weight of the instance observed.

Parameters

  • att_val
  • target_val (Union[bool, str, int, numbers.Number])
  • sample_weight (float)