ColumnEnsembleClassifier
Applies estimators to columns of an array or pandas DataFrame.
This estimator allows different columns or column subsets of the input to be transformed separately and the features generated by each transformer will be ensembled to form a single output.
Schnellstart
from sktime.classification.compose import ColumnEnsembleClassifier
estimator = ColumnEnsembleClassifier(estimators, remainder='drop', verbose=False)Parameter(2)
- estimatorslist of tuples
List of (name, estimator, column(s)) tuples specifying the transformer objects to be applied to subsets of the data.
- namestring
Like in Pipeline and FeatureUnion, this allows the transformer and its parameters to be set using
set_paramsand searched in grid search.
- remainder{‘drop’, ‘passthrough’} or estimator, default ‘drop’
By default, only the specified columns in
transformationsare transformed and combined in the output, and the non-specified columns are dropped. (default of'drop'). By specifyingremainder='passthrough', all remaining columns that were not specified intransformationswill be automatically passed through. This subset of columns is concatenated with the output of the transformations. By settingremainderto be an estimator, the remaining non-specified columns will use theremainderestimator. The estimator must supportfitandtransform.
Beispiele
>>> from sktime.classification.dictionary_based import ContractableBOSS
>>> from sktime.classification.interval_based import CanonicalIntervalForest
>>> from sktime.datasets import load_basic_motions
>>> X_train, y_train = load_basic_motions (split = "train")
>>> X_test, y_test = load_basic_motions (split = "test")
>>> cboss = ContractableBOSS (
... n_parameter_samples = 4, max_ensemble_size = 2, random_state = 0
... )
>>> cif = CanonicalIntervalForest (
... n_estimators = 2, n_intervals = 4, att_subsample_size = 4, random_state = 0
... )
>>> estimators = [("cBOSS", cboss, 5), ("CIF", cif, [3, 4 ])]
>>> col_ens = ColumnEnsembleClassifier (estimators = estimators)
>>> col_ens. fit (X_train, y_train) ColumnEnsembleClassifier(
... )
>>> y_pred = col_ens. predict (X_test)