Skip to content

HistogramSplitter

Numeric attribute observer for classification tasks that discretizes features using histograms.

Parameters

  • n_bins

    Typeint

    Default256

    The maximum number of bins in the histogram.

  • n_splits

    Typeint

    Default32

    The number of split points to evaluate when querying for the best split candidate.

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'SplitCriterion'
  • pre_split_dist'list | dict'
  • att_idx'base.typing.FeatureName'
  • binary_only'bool'

Returns

BranchFactory: Suggestion of the best attribute split.

cond_proba

Get the probability for an attribute value given a class.

Parameters

  • att_val
  • target_val'base.typing.ClfTarget'

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'base.typing.Target'
  • sample_weight'float'