bqlearn.corruptions.noisy_leaves_probability

bqlearn.corruptions.noisy_leaves_probability(X, y, *, noise_ratio=0.5, purity='random', min_samples_leaf=1, random_state=None)[source]

Noisify some leaves of a decision tree learn on the input dataset. These leaves can be chosen completly at random or prioritizing them by their purity.

Parameters:
Xarray-like of shape (n_samples, n_features)

The samples.

yarray-like of shape (n_samples, )

The targets.

noise_ratiofloat, default=0.5

The ratio of noise. Must be between 0 and 1.

purity: {‘random’, ‘ascending’, ‘descending’}, default=’random’

Choose leaves completly at random or prioritize pure/impure leaves.

min_samples_leafint or float, default=1

The minimum number of samples required to be at a leaf node. - If int, then consider min_samples_leaf as the minimum number. - If float, then min_samples_leaf is a fraction and ceil(min_samples_leaf * n_samples) are the minimum number of samples for each node.

random_stateint or RandomState, default=None

Controls the training of the DecisionTreeClassifier and the noisy leaves selection.

Returns:
noise_probabilitiesarray-like of shape (n_samples, )

The noise probabilities.