pyFTS.common.transformations package

Module contents

Submodules

pyFTS.common.transformations.adapativeexpectation module

pyFTS.common.transformations.boxcox module

class pyFTS.common.transformations.boxcox.BoxCox(plambda)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

Box-Cox power transformation

y’(t) = log( y(t) ) y(t) = exp( y’(t) )

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

property parameters

pyFTS.common.transformations.differential module

class pyFTS.common.transformations.differential.Differential(lag)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

Differentiation data transform

y’(t) = y(t) - y(t-1) y(t) = y(t-1) + y’(t)

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

property parameters

pyFTS.common.transformations.normalization module

class pyFTS.common.transformations.normalization.Normalization(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

train(data, **kwargs)[source]

pyFTS.common.transformations.roi module

class pyFTS.common.transformations.roi.ROI(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

Return of Investment (ROI) transformation. Retrieved from Sadaei and Lee (2014) - Multilayer Stock Forecasting Model Using Fuzzy Time Series

y’(t) = ( y(t) - y(t-1) ) / y(t-1) y(t) = ( y(t-1) * y’(t) ) + y(t-1)

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

pyFTS.common.transformations.scale module

class pyFTS.common.transformations.scale.Scale(min=0, max=1)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

Scale data inside a interval [min, max]

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

property parameters

pyFTS.common.transformations.smoothing module

class pyFTS.common.transformations.smoothing.AveragePooling(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

apply(data)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

class pyFTS.common.transformations.smoothing.ExponentialSmoothing(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

class pyFTS.common.transformations.smoothing.MaxPooling(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

apply(data)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

class pyFTS.common.transformations.smoothing.MovingAverage(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

pyFTS.common.transformations.som module

Kohonen Self Organizing Maps for Fuzzy Time Series

class pyFTS.common.transformations.som.SOMTransformation(grid_dimension: Tuple, **kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

apply(data: pandas.core.frame.DataFrame, param=None, **kwargs)[source]

Transform a M-dimensional dataset into a 3-dimensional dataset, where one dimension is the endogen variable If endogen_variable = None, the last column will be the endogen_variable.

Args:

data (pd.DataFrame): M-Dimensional dataset endogen_variable (str): column of dataset names (Tuple): names for new columns created by SOM Transformation. param: **kwargs: params of SOM’s train process

percentage_train (float). Percentage of dataset that will be used for train SOM network. default: 0.7 leaning_rate (float): leaning rate of SOM network. default: 0.01 epochs: epochs of SOM network. default: 10000

Returns:

save_net(filename: str = 'SomNet trained')[source]
show_grid(graph_type: str = 'nodes_graph', **kwargs)[source]
train(data: pandas.core.frame.DataFrame, percentage_train: float = 0.7, leaning_rate: float = 0.01, epochs: int = 10000)[source]

pyFTS.common.transformations.transformation module

class pyFTS.common.transformations.transformation.Transformation(**kwargs)[source]

Bases: object

Data transformation used on pre and post processing of the FTS

apply(data, param, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

inverse(data, param, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

is_multivariate

detemine if this transformation can be applied to multivariate data

pyFTS.common.transformations.trend module

class pyFTS.common.transformations.trend.LinearTrend(**kwargs)[source]

Bases: pyFTS.common.transformations.transformation.Transformation

Linear Trend. Estimate

y’(t) = y(t) - (a*t+b) y(t) = y’(t) + (a*t+b)

apply(data, param=None, **kwargs)[source]

Apply the transformation on input data

Parameters
  • data – input data

  • param

  • kwargs

Returns

numpy array with transformed data

data_field

The Pandas Dataframe column to use as data

datetime_mask

The Pandas Dataframe mask for datetime indexes

generate_indexes(data, value, **kwargs)[source]
increment(value, **kwargs)[source]
index_field

The Pandas Dataframe column to use as index

index_type

The type of the time index used to train the regression coefficients. Available types are: field, datetime

inverse(data, param=None, **kwargs)[source]
Parameters
  • data – transformed data

  • param

  • kwargs

Returns

numpy array with inverse transformed data

model

Regression model

train(data, **kwargs)[source]
trend(data)[source]