tsproto.models.PrototypeEncoder
- class tsproto.models.PrototypeEncoder(blackbox, min_size, jump, pen, n_clusters, multiplier=1.5, global_breakpointing=False, method='kshape', descriptors=['existance', 'duration', 'stats', 'similarity'], n_jobs=None, verbose=0, dims=1, sampling_rate=1, feature_names=None, importance_aggregation_func=<function mean>, pelt_model='rbf')
Encodes time-series into prototypes
- __init__(blackbox, min_size, jump, pen, n_clusters, multiplier=1.5, global_breakpointing=False, method='kshape', descriptors=['existance', 'duration', 'stats', 'similarity'], n_jobs=None, verbose=0, dims=1, sampling_rate=1, feature_names=None, importance_aggregation_func=<function mean>, pelt_model='rbf')
Initializes PrototypeEncoder class
- Parameters:
blackbox – instance of a blackbox model that is to be explained
min_size – minimum size of a prototype (Pelt algorithm parameter)
jump – subsample (one every jump points) (Pelt algorithm parameter)
pen – penalty value (>0) for Pelt algorithm parameter.
n_clusters – number of clusters to generated (these are going to be prototypes). It can be int, float or dict.
If float, the number of clusters is determined dynamically as a product of the parameter and the average number of breakpoints detected in the particualr dimension. :param pelt_model: model for Pelt changepoint detection it can be l1, l2, or rbf. :param multiplier: multiplier used in outlier detection. The smaller the value the stronger reduction of outliers :param method: clustering algorithms method. Default dtw. Possible options: [‘dtw’,’kshape’,’tskshape’,’rocket’,’kmeans’,’rocket’] :param descriptors: what description functions use to describe prototypes. :param n_jobs: parallelization. Default None :param verbose: verbosity level. Possible values 0, 1, 2. Default 0 :param dims: number of dimensions/features in time series. Default 1 :param sampling_rate: sampling rate used to calculate dominant frequency. Default 1 :param feature_names: list of feature names. Default None :param importance_aggregation_func: function to aggregate shap values. Default np.mean
Methods
__init__(blackbox, min_size, jump, pen, ...)Initializes PrototypeEncoder class
fit(X, shapclass)fit_transform(X, shapclass)Fit to data, then transform it.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_fit_request(*[, shapclass])Request metadata passed to the
fitmethod.set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
set_transform_request(*[, shapclass])Request metadata passed to the
transformmethod.transform(X, shapclass)