Transformers and splitters#

A Stump is a transformer, which turns the data into a feature matrix, followed by a splitter, which finds the best split of that matrix. Any transformer can be combined with any splitter. See Extending the library.

Transformers#

MatrixTransformer

Transformer that uses the data as feature matrix: tabular data as they are, time series and images flattened into one feature per value.

PivotTransformer

Transformer into the distances from candidate pivots, instances of the node that describe a class (medoids) or separate the classes.

PartialPivotTransformer

Transformer of tabular data into the distances from partial pivots, instances of the node restricted to subsets of the features.

ProximityPivotTransformer

Transformer of tabular data, time series and images into pivot comparisons: for each pair of candidate pivots, whether the instance is closer to the second one than to the first.

ObliquePivotTransformer

Transformer of tabular data, time series and images into oblique directions on the distances from the candidate pivots, e.g. 0.7 * P_12 - 0.3 * P_57 where P_i is the distance from the training instance i.

ObliqueTransformer

Base class of the transformers into linear combinations of the numerical features (oblique directions): each column of the feature matrix is X[:, numerical] @ coefficients_[:, j], so a threshold on it is an oblique hyperplane, e.g. 0.8 * X_2 - 0.6 * X_3 <= 1.5.

HouseholderTransformer

Transformer into the oblique directions given by a Householder reflection: the reflection that maps the principal component of the instances of the node onto the closest axis.

BivariateTransformer

Transformer into oblique directions on a pair of features: cos(a) * X_i + sin(a) * X_j for n_orientations angles a between 0 and 180 degrees.

ShapeletTransformer

Transformer of time series into their distances from shapelets, subsequences selected among the ones of the time series in the node.

ProximityTransformer

Transformer of time series into proximity comparisons: for each pair of shapelets, whether the time series is closer to the second one than to the first.

PartialProximityTransformer

Transformer of tabular data into proximity comparisons: for each pair of partial pivots (instances of the node restricted to a few features), whether the instance is closer to the second one than to the first.

TfidfTransformer

Transformer of texts into the TF-IDF weights of their words (scikit-learn's TfidfVectorizer): one feature per word of the vocabulary, so that a split is a threshold on the weight of a word, e.g. goal <= 0.21.

Splitters#

ClassificationSplitter

Splitter for classification that maximizes the decrease of impurity (information gain).

RegressionSplitter

Splitter for regression that maximizes the decrease of impurity.

XGBoostSplitter

Splitter for regression that maximizes the XGBoost gain: the similarity scores of the two children minus the one of the node, where the target are the residuals of the previous trees.

FairSplitter

Splitter for regression that maximizes the gain penalized by the unfairness of the split with respect to a sensitive attribute.

FlatMatrixClassificationSplitter

Splitter for classification that evaluates all the candidate splits together with matrix operations (see FlatMatrixSplitter) and maximizes the decrease of impurity.

FlatMatrixRegressionSplitter

Splitter for regression that evaluates all the candidate splits together with matrix operations (see FlatMatrixSplitter) and maximizes the decrease of impurity.

DecisionTreeSplitter

Base class of the splitters that maximize the decrease of impurity, ClassificationSplitter and RegressionSplitter.

FlatMatrixSplitter

Base class of the splitters that evaluate all the candidate splits of a node together: FlatMatrixClassificationSplitter and FlatMatrixRegressionSplitter.

candidate_mask

Instances that go to the left child of each candidate split.

information_gain

Decrease of impurity of one or more splits.