TreeClassificationTransformer

class proglearn.TreeClassificationTransformer(kwargs={})[source]

A class used to transform data from a category to a specialized representation.

Parameters

kwargs : dict, default={}

A dictionary to contain parameters of the tree.

Attributes

transformer

(sklearn.tree.DecisionTreeClassifier) an internal sklearn DecisionTreeClassifier

Methods Summary

TreeClassificationTransformer.fit(X, y)

Fits the transformer to data X with labels y.

TreeClassificationTransformer.fit_transform(X)

Fit to data, then transform it.

TreeClassificationTransformer.get_params([deep])

Get parameters for this estimator.

TreeClassificationTransformer.set_params(...)

Set the parameters of this estimator.

TreeClassificationTransformer.transform(X)

Performs inference using the transformer.


TreeClassificationTransformer.fit(X, y)[source]

Fits the transformer to data X with labels y.

Parameters

X : ndarray

Input data matrix.

y : ndarray

Output (i.e. response data matrix).

Returns

self : TreeClassificationTransformer

The object itself.

TreeClassificationTransformer.fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters

X : array-like of shape (n_samples, n_features)

Input samples.

y : array-like of shape (n_samples,) or (n_samples, n_outputs), default=None

Target values (None for unsupervised transformations).

**fit_params : dict

Additional fit parameters.

Returns

X_new : ndarray array of shape (n_samples, n_features_new)

Transformed array.

TreeClassificationTransformer.get_params(deep=True)

Get parameters for this estimator.

Parameters

deep : bool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params : dict

Parameter names mapped to their values.

TreeClassificationTransformer.set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it's possible to update each component of a nested object.

Parameters

**params : dict

Estimator parameters.

Returns

self : estimator instance

Estimator instance.

TreeClassificationTransformer.transform(X)[source]

Performs inference using the transformer.

Parameters

X : ndarray

Input data matrix.

Returns

X_transformed : ndarray

The transformed input.

Raises

NotFittedError

When the model is not fitted.