IntervalSegmenter¶
- class IntervalSegmenter(intervals=10)[source]¶
Interval segmentation transformer.
- Parameters
- intervalsint, np.ndarray or list of np.ndarrays with one for each
- column of input data.
Intervals to generate. – If int, intervals gives the number of generated intervals. – If ndarray, 2d np.ndarray [n_intervals, 2] with rows giving intervals, the first column giving start points, and the second column giving end points of intervals
- Attributes
is_fittedWhether fit has been called.
Methods
Check if the estimator has been fitted.
clone_tags(estimator[, tag_names])clone/mirror tags from another estimator as dynamic override.
Construct Estimator instance if possible.
fit(X[, y])Fit transformer, generating random interval indices.
fit_transform(Z[, X])Fit to data, then transform it.
get_class_tag(tag_name[, tag_value_default])Get tag value from estimator class (only class tags).
Get class tags from estimator class and all its parent classes.
get_params([deep])Get parameters for this estimator.
get_tag(tag_name[, tag_value_default, …])Get tag value from estimator class and dynamic tag overrides.
get_tags()Get tags from estimator class and dynamic tag overrides.
Return testing parameter settings for the estimator.
set_params(**params)Set the parameters of this estimator.
set_tags(**tag_dict)Set dynamic tags to given values.
transform(X[, y])Transform X, segments time-series in each column into random intervals using interval indices generated during fit.
- fit(X, y=None)[source]¶
Fit transformer, generating random interval indices.
- Parameters
- Xpandas DataFrame of shape [n_samples, n_features]
Input data
- ypandas Series, shape (n_samples, …), optional
Targets for supervised learning.
- Returns
- selfan instance of self.
- transform(X, y=None)[source]¶
Transform X, segments time-series in each column into random intervals using interval indices generated during fit.
- Parameters
- Xnested pandas DataFrame of shape [n_samples, n_features]
Nested dataframe with time-series in cells.
- Returns
- Xtpandas DataFrame
Transformed pandas DataFrame with same number of rows and one column for each generated interval.
- check_is_fitted()[source]¶
Check if the estimator has been fitted.
- Raises
- NotFittedError
If the estimator has not been fitted yet.
- clone_tags(estimator, tag_names=None)[source]¶
clone/mirror tags from another estimator as dynamic override.
- Parameters
- estimatorestimator inheriting from :class:BaseEstimator
- tag_namesstr or list of str, default = None
Names of tags to clone. If None then all tags in estimator are used as tag_names.
- Returns
- Self :
Reference to self.
Notes
Changes object state by setting tag values in tag_set from estimator as dynamic tags in self.
- classmethod create_test_instance()[source]¶
Construct Estimator instance if possible.
- Returns
- instanceinstance of the class with default parameters
Notes
get_test_params can return dict or list of dict. This function takes first or single dict that get_test_params returns, and constructs the object with that.
- fit_transform(Z, X=None)[source]¶
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
- Zpd.DataFrame, pd.Series or np.ndarray
Data to be transformed
- Xpd.Series or np.ndarray, optional (default=None)
Target values of data to be transformed.
- Returns
- Ztpd.DataFrame, pd.Series or np.ndarray
Transformed data.
- classmethod get_class_tag(tag_name, tag_value_default=None)[source]¶
Get tag value from estimator class (only class tags).
- Parameters
- tag_namestr
Name of tag value.
- tag_value_defaultany type
Default/fallback value if tag is not found.
- Returns
- tag_value :
Value of the tag_name tag in self. If not found, returns tag_value_default.
- classmethod get_class_tags()[source]¶
Get class tags from estimator class and all its parent classes.
- Returns
- collected_tagsdict
Dictionary of tag name : tag value pairs. Collected from _tags class attribute via nested inheritance. NOT overridden by dynamic tags set by set_tags or mirror_tags.
- get_params(deep=True)[source]¶
Get parameters for this estimator.
- Parameters
- deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
- paramsdict
Parameter names mapped to their values.
- get_tag(tag_name, tag_value_default=None, raise_error=True)[source]¶
Get tag value from estimator class and dynamic tag overrides.
- Parameters
- tag_namestr
Name of tag to be retrieved
- tag_value_defaultany type, optional; default=None
Default/fallback value if tag is not found
- raise_errorbool
whether a ValueError is raised when the tag is not found
- Returns
- tag_value :
Value of the tag_name tag in self. If not found, returns an error if raise_error is True, otherwise it returns tag_value_default.
- Raises
- ValueError if raise_error is True i.e. if tag_name is not in self.get_tags(
- ).keys()
- get_tags()[source]¶
Get tags from estimator class and dynamic tag overrides.
- Returns
- collected_tagsdict
Dictionary of tag name : tag value pairs. Collected from _tags class attribute via nested inheritance and then any overrides and new tags from _tags_dynamic object attribute.
- classmethod get_test_params()[source]¶
Return testing parameter settings for the estimator.
- Returns
- paramsdict or list of dict, default = {}
Parameters to create testing instances of the class Each dict are parameters to construct an “interesting” test instance, i.e., MyClass(**params) or MyClass(**params[i]) creates a valid test instance. create_test_instance uses the first (or only) dictionary in params
- property is_fitted[source]¶
Whether fit has been called.
- set_params(**params)[source]¶
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
- **paramsdict
Estimator parameters.
- Returns
- selfestimator instance
Estimator instance.
- set_tags(**tag_dict)[source]¶
Set dynamic tags to given values.
- Parameters
- tag_dictdict
Dictionary of tag name : tag value pairs.
- Returns
- Self :
Reference to self.
Notes
Changes object state by settting tag values in tag_dict as dynamic tags in self.