fABBA.fabba_model

class fABBA.fabba_model(tol=0.1, alpha=0.5, sorting='2-norm', scl=1, verbose=1, max_len=- 1, return_list=False, n_jobs=1)[source]

fABBA: A fast sorting-based aggregation method for symbolic time series representation

tol - float, default=0.1

Control tolerence for compression.

alpha - float, default=0.5

Control tolerence for digitization.

sorting - str, default=’2-norm’, {‘lexi’, ‘1-norm’, ‘2-norm’}

by which the sorting pieces prior to aggregation.

scl - int, default=1

Scale for length, default as 1, refers to 2d-digitization, otherwise implement 1d-digitization.

verbose - int, default=1

Verbosity mode, control logs print, default as 1; print logs.

max_len - int, default=-1

The max length for each segment, optional choice for compression.

return_list - boolean, default=True

Whether to return with list or not, “False” means return string.

n_jobs - int, default=-1

The number of threads to use for the computation. -1 means no parallel computing.

parameters - Model

Contains the learnable parameters from the in-sample data.

Attributes: * centers - numpy.ndarray

the centers calculated for each group formed by aggregation

  • splist - numpy.ndarray

    the starting point for each group formed by aggregation

  • hashmap - dict

    store the oen to one key-value pair for labels earmarked for the groups and the corresponding character

>>> import numpy as np
>>> from fABBA.symbolic_representation import model
>>> np.random.seed(1)
>>> N = 100
>>> x = np.random.rand(N)
>>> fabba = model(tol=0.1, alpha=0.5, sorting='lexi', scl=1, verbose=1, max_len=np.inf, return_list=True) 
>>> print(fabba)
fABBA(tol=0.1, alpha=0.5, sorting='lexi', scl=1, verbose=1, max_len=inf, return_list=True)
>>> string = fabba.fit_transform(x)
>>> inverse_ts = fabba.inverse_transform(string, x[0])
>>> import matplotlib.pyplot as plt
>>> plt.plot(x, label='time series', c='olive')
>>> plt.plot(inverse_ts, label='reconstruction', c='darkblue')
>>> plt.legend()
>>> plt.grid(True)
>>> plt.show()
  • In addition to fit_transform, the compression and digitization functions are

independent applicable to data.

__init__(tol=0.1, alpha=0.5, sorting='2-norm', scl=1, verbose=1, max_len=- 1, return_list=False, n_jobs=1)[source]

This class is designed for other clustering based ABBA

tol - float

Control tolerence for compression, default as 0.1.

scl - int

Scale for length, default as 1, means 2d-digitization, otherwise implement 1d-digitization.

verbose - int

Control logs print, default as 1, print logs.

max_len - int

The max length for each segment, default as -1.

Methods

__init__([tol, alpha, sorting, scl, ...])

This class is designed for other clustering based ABBA

aggregate(data)

compress(series[, fillm])

Compress time series.

digitize(pieces[, alphabet_set])

Greedy 2D clustering of pieces (a Nx2 numpy array), using tolernce alpha and len/inc scaling parameter scl.

dump([file])

fit_transform(series[, fillm, alphabet_set])

Compress and digitize the time series together.

inverse_transform(strings[, start, parameters])

Convert ABBA symbolic representation back to numeric time series representation.

load([file, replace])

print_parameters(cls)

reassign_labels(labels)

Attributes

alpha

max_len

n_jobs

return_list

scl

sorting

tol

verbose