FABBA
FABBA
- class FABBA(method: str = 'agg', tolerance: float = 0.2, alpha: float | None = 0.5, auto_digitize: bool = False, sorting: str | None = 'norm', k: int = 2, batch_size: int = 1024, scl: float = 1.0, max_iter: int = 2, if_partition: bool = False, partition_rate: float | None = None, num_partition: int | None = None, partition_idx: list[int] | int | None = None, max_len: int | None = None, random_state: int | None = None, return_as_strings: bool = False, return_start_values: bool = False, alphabet_set: int | list = 0, n_jobs: int = -1)[source]
fABBA - An efficient symbolic aggregate approximation for temporal data.
fABBA_[1] is a dimensionality reduction technique that works by making symbolic approximation of temporal data, it well-suited for tasks such as compression, clustering, and classification. It converts time series data to sequence of tuples by adaptive polygonal chain approximation. It then uses clustering methods on these tuples and assigns symbols to the clusters. The core implementation is derived from the fABBA library_[2].
- Parameters:
- methodstr, optional (default=”agg”, {“agg”, “kmeans”, “mini-kmeans”})
clustering method to use for symbolization
- tolerancefloat, optional (default=0.2, greater than 0)
tolerance for polygonal chain approximation
- alphafloat, optional (default=0.5, greater than 0)
distance threshold for aggregation used only if method is “agg” and auto_digitize is False if auto_digitize is True, alpha is determined automatically
- auto_digitizebool, optional (default=False)
whether to automatically determine alpha for aggregation used only if method is “agg” if auto_digitize is True, alpha is determined automatically and input alpha is ignored
- sortingstr, optional (default=”norm”, {“norm”, “pca”, None})
sorting method to use for aggregation/clustering used only if method is “agg”
- kint, optional (default=2, greater equal 2)
number of clusters to form, used only if method is “kmeans” or “mini-kmeans”
- batch_sizeint, optional (default=1024, greater equal 1)
number of samples per batch for MiniBatchKMeans used only if method is “mini-kmeans”
- max_iterint, optional (default=2, greater equal 1)
maximum number of iterations for clustering methods used only if method is “kmeans” or “mini-kmeans”
- sclfloat, optional (default=1, greater equal 0)
scaling factor for length in clustering
- if_parition: bool, optinal(default=False)
determines if to parition series for parallel processing used only if input is a single series uses parition_rate or num_partition or parition_idx
- partition_ratefloat, optional (default=None, greater equal 0)
rate to determine number of partitions for parallel processing used only if input is a single series and if_parition is True if partition_rate is None, number of partitions is set to number of processors
- num_partitionint, optional (default=None, greater equal 1)
number of partitions for parallel processing used only if input is a single series and if_parition is True if partition is None, number of partitions is set based on partition_rate
- partition_idxlist(int), optional (default=None, list of int greater equal 0)
indexes to partition on for parallel processing used only if input is a single series and if_parition is True if partition_idx is None, number of partitions is set based on parition
- max_lenint, optional (default=np.inf, greater equal 1 or -1)
maximum length of segments for polygonal chain approximation -1 means no limit
- random_stateint, optional (default=None)
random state for clustering methods used only if method is “kmeans” or “mini-kmeans”
- return_as_stringsbool, optional (default=False)
whether to return symbolized series as strings or integer labels
- return_start_valuesbool, optional (default=False)
whether to return the start values of each series start value is returned as first value in transformed data necessary for inverse transform
- alphabet_setint or list, optional (default=0, {0, 1} or list of strings)
alphabet set to use for symbolization if int 0 uses mixed case, if int 1 uses upper case then lower case if list uses the provided list of strings as alphabet set
- n_jobsint, optional (default=-1)
number of parallel jobs to run, -1 means using all processors
- Attributes:
is_fittedWhether
fithas been called.
References
[1]Chen.
An efficient aggregation method for the symbolic representation of temporal data. arXiv preprint arXiv:2201.05697 (2022). https://arxiv.org/abs/2201.05697
[2]Chen and S. Güttel.
fABBA: A Python library for the fast symbolic approximation of time series. Journal of Open Source Software (2024). https://joss.theoj.org/papers/10.21105/joss.06294
[3]Chen and S. Güttel.
An Efficient Aggregation Method for the Symbolic Representation of Temporal Data. ACM Trans. Knowl. Discov. Data (2023). https://dl.acm.org/doi/abs/10.1145/3532622
[4]Elsworth and S. Güttel.
ABBA: adaptive Brownian bridge-based symbolic aggregation of time serie. https://arxiv.org/abs/2003.12469
Examples
>>> from sktime.transformations.fabba import FABBA >>> from sktime.datasets import load_airline >>> y = load_airline() >>> transformer = FABBA( ... n_jobs=1, ... random_state=42, ... return_start_values=True, ... method="agg", ... tolerance=0.001, ... alpha=0.05, ... ) >>> y_transformed = transformer.fit_transform(y) >>> y_reconstructed = transformer.inverse_transform(y_transformed)
Methods
check_is_fitted([method_name])Check if the estimator has been fitted.
clone()Obtain a clone of the object with same hyper-parameters and config.
clone_tags(estimator[, tag_names])Clone tags from another object as dynamic override.
create_test_instance([parameter_set])Construct an instance of the class, using first test parameter set.
create_test_instances_and_names([parameter_set])Create list of all test instances and a list of names for them.
fit(X[, y])Fit transformer to X, optionally to y.
fit_transform(X[, y])Fit to data, then transform it.
get_class_tag(tag_name[, tag_value_default])Get class tag value from class, with tag level inheritance from parents.
get_class_tags()Get class tags from class, with tag level inheritance from parent classes.
get_config()Get config flags for self.
get_fitted_params([deep])Get fitted parameters.
get_param_defaults()Get object's parameter defaults.
get_param_names([sort])Get object's parameter names.
get_params([deep])Get a dict of parameters values for this object.
get_tag(tag_name[, tag_value_default, ...])Get tag value from instance, with tag level inheritance and overrides.
get_tags()Get tags from instance, with tag level inheritance and overrides.
get_test_params([parameter_set])Return testing parameter settings for the estimator.
inverse_transform(X[, y])Inverse transform X and return an inverse transformed version.
is_composite()Check if the object is composed of other BaseObjects.
load_from_path(serial)Load object from file location.
load_from_serial(serial)Load object from serialized memory container.
reset()Reset the object to a clean post-init state.
save([path, serialization_format])Save serialized self to bytes-like object or to (.zip) file.
set_config(**config_dict)Set config flags to given values.
set_params(**params)Set the parameters of this object.
set_random_state([random_state, deep, ...])Set random_state pseudo-random seed parameters for self.
set_tags(**tag_dict)Set instance level tag overrides to given values.
transform(X[, y])Transform X and return a transformed version.
update(X[, y, update_params])Update transformer with X, optionally y.

