wildboar.transform._sax#

Module Contents#

Classes#

Binning

NormalBinning

PAA

Peicewise aggregate approximation

SAX

Symbolic aggregate approximation

UniformBinning

Functions#

piecewice_aggregate_approximation(x, *[, n_intervals, ...])

Peicewise aggregate approximation

symbolic_aggregate_approximation(x, *[, n_intervals, ...])

Symbolic aggregate approximation

class wildboar.transform._sax.Binning(n_bins)[source]#
get_thresholds(x=None, estimate=False)[source]#
abstract scale(x)[source]#
class wildboar.transform._sax.NormalBinning(n_bins)[source]#

Bases: Binning

scale(x)[source]#
class wildboar.transform._sax.PAA(n_intervals='sqrt', window=None)[source]#

Bases: sklearn.base.TransformerMixin, wildboar.base.BaseEstimator

Peicewise aggregate approximation

property intervals[source]#
fit(x, y=None)[source]#
inverse_transform(x)[source]#
transform(x)[source]#
class wildboar.transform._sax.SAX(*, n_intervals='sqrt', window=None, n_bins=4, binning='normal', estimate=True)[source]#

Bases: sklearn.base.TransformerMixin, wildboar.base.BaseEstimator

Symbolic aggregate approximation

Parameters:
  • x (array-like of shape (n_samples, n_timestep)) – The input data.

  • n_intervals (str, optional) –

    The number of intervals to use for the transform.

    • if “log”, the number of intervals is log2(n_timestep).

    • if “sqrt”, the number of intervals is sqrt(n_timestep).

    • if int, the number of intervals is n_intervals.

    • if float, the number of intervals is n_intervals * n_timestep, with

      0 < n_intervals < 1.

  • window (int, optional) – The window size. If window is set, the value of n_intervals has no effect.

  • n_bins (int, optional) – The number of bins.

  • binning (str, optional) – The bin construction. By default the bins are defined according to the normal distribution. Possible values are "normal" for normally distributed bins or "uniform" for uniformly distributed bins.

  • estimate (bool, optional) –

    Estimate the distribution parameters for the binning from data.

    If estimate=False, it is assumed that each time series are:

    • preprocessed using datasets.preprocess.normalize() when binning="normal".

    • preprocessed using datasets.preprocess.minmax_scale(). when binning="uniform"

property intervals[source]#
fit(x, y=None)[source]#
inverse_transform(x)[source]#
transform(x)[source]#
class wildboar.transform._sax.UniformBinning(n_bins)[source]#

Bases: Binning

scale(x)[source]#
wildboar.transform._sax.piecewice_aggregate_approximation(x, *, n_intervals='sqrt', window=None)[source]#

Peicewise aggregate approximation

Parameters:
  • x (array-like of shape (n_samples, n_timestep)) – The input data.

  • n_intervals (str, optional) –

    The number of intervals to use for the transform.

    • if “log”, the number of intervals is log2(n_timestep).

    • if “sqrt”, the number of intervals is sqrt(n_timestep).

    • if int, the number of intervals is n_intervals.

    • if float, the number of intervals is n_intervals * n_timestep, with

      0 < n_intervals < 1.

  • window (int, optional) – The window size. If window is set, the value of n_intervals has no effect.

Returns:

paa – The symbolic aggregate approximation

Return type:

ndarray of shape (n_samples, n_intervals)

wildboar.transform._sax.symbolic_aggregate_approximation(x, *, n_intervals='sqrt', window=None, n_bins=4, binning='normal')[source]#

Symbolic aggregate approximation

Parameters:
  • x (array-like of shape (n_samples, n_timestep)) – The input data.

  • n_intervals (str, optional) –

    The number of intervals to use for the transform.

    • if “log”, the number of intervals is log2(n_timestep).

    • if “sqrt”, the number of intervals is sqrt(n_timestep).

    • if int, the number of intervals is n_intervals.

    • if float, the number of intervals is n_intervals * n_timestep, with

      0 < n_intervals < 1.

  • window (int, optional) – The window size. If window is set, the value of n_intervals has no effect.

  • n_bins (int, optional) – The number of bins.

  • binning (str, optional) – The bin construction. By default the bins are defined according to the normal distribution. Possible values are "normal" for normally distributed bins or "uniform" for uniformly distributed bins.

Returns:

sax – The symbolic aggregate approximation

Return type:

ndarray of shape (n_samples, n_intervals)