EDAspy.timeseries package

Submodules

EDAspy.timeseries.TS_transformations module

class EDAspy.timeseries.TS_transformations.TSTransformations(data)[source]

Bases: object

Tool to calculate time series transformations. Some time series transformations are given. This is just a very simple tool. It is not mandatory to use this tool to use the time series transformations selector. It is only disposed to be handy.

data = -1

Removes the trend of the time series.

Parameters:
  • variable (string) – string available in data DataFrame

  • plot (bool) – if True plot is give, if False, not

Returns:

time series detrended

Return type:

list

log(variable, plot=False)[source]

Calculate the logarithm of the time series.

Parameters:
  • variable (string) – name of variables

  • plot (bool) – if True a plot is given.

Returns:

time series transformation

Return type:

list

box_cox(variable, lmbda, plot=False)[source]

Calculate Box Cox time series transformation.

Parameters:
  • variable (string) – name of variable

  • lmbda (float) – lambda parameter of Box Cox transformation

  • plot (bool) – if True, plot is given.ç

Returns:

time series transformation

Return type:

list

smoothing(variable, window, plot=False)[source]

Calculate time series smoothing transformation.

Parameters:
  • variable (string) – name of variable

  • window (int) – number of previous instances taken to smooth.

  • plot (bool) – if True, plot is given

Returns:

time series transformation

Return type:

list

power(variable, power, plot=False)[source]

Calculate power time series transformation.

Parameters:
  • variable (string) – name of variable

  • power (int) – exponent to calculate

  • plot (bool) – if True, plot is given

Returns:

time series transformation

Return type:

list

exponential(variable, numerator, plot=False)[source]

Calculate exponential time series transformation.

Parameters:
  • variable (string) – name of variable

  • numerator (int) – numerator of the transformation

  • plot (bool) – if True, plot is given

Returns:

time series transformation

Return type:

list

EDAspy.timeseries.TransformationsFeatureSelection module

class EDAspy.timeseries.TransformationsFeatureSelection.TransformationsFSEDA(max_it, dead_it, size_gen, alpha, vector, array_transformations, cost_function)[source]

Bases: object

Estimation of Distribution Algorithm that uses a Dirichlet distribution to select among the different time series transformations that best improve the cost function to optimize.

Attributes:

generation: pandas DataFrame

Last generation of the algorithm.

best_MAE: float

Best cost found.

best_ind: pandas DataFrame

First row of the pandas DataFrame. Can be casted to dictionary.

history_best: list

List of the costs found during runtime.

size_gen: int

Parameter set by user. Number of the individuals in each generation.

max_it: int

Parameter set by user. Maximum number of iterations of the algorithm.

dead_it: int

Parameter set by user. Number of iterations after which, if no improvement reached, the algorithm finishes.

vector: pandas DataFrame

When initialized, parameters set by the user. When finished, statistics learned by the user.

cost_function:

Set by user. Cost function set to optimize.

generation = Empty DataFrame Columns: [] Index: []
output_plot = ''
historic_best = []
best_MAE = 99999999999
best_ind = ''
new_generation()[source]

Creates a new generation of individuals. Updates the generation DataFrame

check_generation()[source]

Check the cost of each individual of the generation in the cost function

individuals_selection()[source]

Selection of the best individuals to mutate the next generation

update_vector_probabilities()[source]

Re-build the vector of statistics based on the selection of the best individuals of the generation.

run(output=True)[source]

Algorithm run execution

Parameters:

output (bool) – If True then an output is printed in each iteration. Otherwise, not

Returns:

best_individual, best MAE found

Return type:

list, float

Module contents