time_series_predictor.sklearn package

Subpackages

Submodules

time_series_predictor.sklearn.base module

Base classes for all estimators.

Used for VotingClassifier

class time_series_predictor.sklearn.base.BaseEstimator

Bases: object

Base class for all estimators in scikit-learn

Notes

All estimators should specify all the parameters that can be set at the class level in their __init__ as explicit keyword arguments (no *args or **kwargs).

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 (mapping of string to any) – Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). 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 (object) – Estimator instance.

class time_series_predictor.sklearn.base.BiclusterMixin

Bases: object

Mixin class for all bicluster estimators in scikit-learn

property biclusters_

Convenient way to get row and column indicators together.

Returns the rows_ and columns_ members.

get_indices(i)

Row and column indices of the i’th bicluster.

Only works if rows_ and columns_ attributes exist.

Parameters

i (int) – The index of the cluster.

Returns

  • row_ind (ndarray, dtype=np.intp) – Indices of rows in the dataset that belong to the bicluster.

  • col_ind (ndarray, dtype=np.intp) – Indices of columns in the dataset that belong to the bicluster.

get_shape(i)

Shape of the i’th bicluster.

Parameters

i (int) – The index of the cluster.

Returns

shape (tuple (int, int)) – Number of rows and columns (resp.) in the bicluster.

get_submatrix(i, data)

Return the submatrix corresponding to bicluster i.

Parameters
  • i (int) – The index of the cluster.

  • data (array-like) – The data.

Returns

submatrix (ndarray) – The submatrix corresponding to bicluster i.

Notes

Works with sparse matrices. Only works if rows_ and columns_ attributes exist.

class time_series_predictor.sklearn.base.ClassifierMixin

Bases: object

Mixin class for all classifiers in scikit-learn.

score(X, y, sample_weight=None)

Return the mean accuracy on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.

  • sample_weight (array-like of shape (n_samples,), default=None) – Sample weights.

Returns

score (float) – Mean accuracy of self.predict(X) wrt. y.

class time_series_predictor.sklearn.base.ClusterMixin

Bases: object

Mixin class for all cluster estimators in scikit-learn.

fit_predict(X, y=None)

Perform clustering on X and returns cluster labels.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Input data.

  • y (Ignored) – Not used, present for API consistency by convention.

Returns

labels (ndarray of shape (n_samples,)) – Cluster labels.

class time_series_predictor.sklearn.base.DensityMixin

Bases: object

Mixin class for all density estimators in scikit-learn.

score(X, y=None)

Return the score of the model on the data X

Parameters
  • X (array-like of shape (n_samples, n_features)) –

  • y (Ignored) – Not used, present for API consistency by convention.

Returns

score (float)

class time_series_predictor.sklearn.base.MetaEstimatorMixin

Bases: object

class time_series_predictor.sklearn.base.MultiOutputMixin

Bases: object

Mixin to mark estimators that support multioutput.

class time_series_predictor.sklearn.base.OutlierMixin

Bases: object

Mixin class for all outlier detection estimators in scikit-learn.

fit_predict(X, y=None)

Perform fit on X and returns labels for X.

Returns -1 for outliers and 1 for inliers.

Parameters
  • X ({array-like, sparse matrix, dataframe} of shape (n_samples, n_features)) –

  • y (Ignored) – Not used, present for API consistency by convention.

Returns

y (ndarray of shape (n_samples,)) – 1 for inliers, -1 for outliers.

class time_series_predictor.sklearn.base.RegressorMixin

Bases: object

Mixin class for all regression estimators in scikit-learn.

score(X, y, sample_weight=None)

Return the coefficient of determination R^2 of the prediction.

The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.

Parameters
  • X (array-like of shape (n_samples, n_features)) – Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead, shape = (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

  • y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True values for X.

  • sample_weight (array-like of shape (n_samples,), default=None) – Sample weights.

Returns

score (float) – R^2 of self.predict(X) wrt. y.

Notes

The R2 score used when calling score on a regressor uses multioutput='uniform_average' from version 0.23 to keep consistent with default value of r2_score(). This influences the score method of all the multioutput regressors (except for MultiOutputRegressor).

class time_series_predictor.sklearn.base.TransformerMixin

Bases: object

Mixin class for all transformers in scikit-learn.

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, sparse matrix, dataframe} of shape (n_samples, n_features)) –

  • y (ndarray of shape (n_samples,), default=None) – Target values.

  • **fit_params (dict) – Additional fit parameters.

Returns

X_new (ndarray array of shape (n_samples, n_features_new)) – Transformed array.

time_series_predictor.sklearn.base.clone(estimator, *, safe=True)

Constructs a new estimator with the same parameters.

Clone does a deep copy of the model in an estimator without actually copying attached data. It yields a new estimator with the same parameters that has not been fit on any data.

Parameters
  • estimator ({list, tuple, set} of estimator objects or estimator object) – The estimator or group of estimators to be cloned.

  • safe (bool, default=True) – If safe is false, clone will fall back to a deep copy on objects that are not estimators.

time_series_predictor.sklearn.base.is_classifier(estimator)

Return True if the given estimator is (probably) a classifier.

Parameters

estimator (object) – Estimator object to test.

Returns

out (bool) – True if estimator is a classifier and False otherwise.

time_series_predictor.sklearn.base.is_outlier_detector(estimator)

Return True if the given estimator is (probably) an outlier detector.

Parameters

estimator (object) – Estimator object to test.

Returns

out (bool) – True if estimator is an outlier detector and False otherwise.

time_series_predictor.sklearn.base.is_regressor(estimator)

Return True if the given estimator is (probably) a regressor.

Parameters

estimator (object) – Estimator object to test.

Returns

out (bool) – True if estimator is a regressor and False otherwise.

Module contents

__init__