sktime.series_as_features.base.estimators

class sktime.series_as_features.base.estimators.BaseTimeSeriesForest(base_estimator, n_estimators=100, estimator_params=(), bootstrap=False, oob_score=False, n_jobs=None, random_state=None, verbose=0, warm_start=False, class_weight=None, max_samples=None)[source]

Bases: sklearn.ensemble._forest.BaseForest

Base class for forests of trees.

apply(X)[source]

Apply trees in the forest to X, return leaf indices.

Parameters

X ({array-like, sparse matrix} of shape (n_samples, n_features)) – The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix.

Returns

X_leaves – For each datapoint x in X and for each tree in the forest, return the index of the leaf x ends up in.

Return type

ndarray of shape (n_samples, n_estimators)

decision_path(X)[source]

Return the decision path in the forest.

New in version 0.18.

Parameters

X ({array-like, sparse matrix} of shape (n_samples, n_features)) – The input samples. Internally, its dtype will be converted to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csr_matrix.

Returns

  • indicator (sparse matrix of shape (n_samples, n_nodes)) – Return a node indicator matrix where non zero elements indicates that the samples goes through the nodes. The matrix is of CSR format.

  • n_nodes_ptr (ndarray of shape (n_estimators + 1,)) – The columns from indicator[n_nodes_ptr[i]:n_nodes_ptr[i+1]] gives the indicator value for the i-th estimator.

property feature_importances_[source]

Compute feature importances for time series forest

fit(X, y, sample_weight=None)[source]

Build a forest of trees from the training set (X, y). :param X: The training input samples. Internally, its dtype will be converted

to dtype=np.float32. If a sparse matrix is provided, it will be converted into a sparse csc_matrix.

Parameters
  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – The target values (class labels in classification, real numbers in regression).

  • sample_weight (array-like of shape (n_samples,), default=None) – Sample weights. If None, then samples are equally weighted. Splits that would create child nodes with net zero or negative weight are ignored while searching for a split in each node. In the case of classification, splits are also ignored if they would result in any single class carrying a negative weight in either child node.

Returns

self

Return type

object