pyFTS.models.nonstationary package

Submodules

pyFTS.models.nonstationary.common module

Non Stationary Fuzzy Sets

GARIBALDI, Jonathan M.; JAROSZEWSKI, Marcin; MUSIKASUWAN, Salang. Nonstationary fuzzy sets. IEEE Transactions on Fuzzy Systems, v. 16, n. 4, p. 1072-1086, 2008.

class pyFTS.models.nonstationary.common.FuzzySet(name, mf, parameters, **kwargs)[source]

Bases: pyFTS.common.FuzzySet.FuzzySet

Non Stationary Fuzzy Sets

alpha: float

The alpha cut value

centroid: float

The fuzzy set center of mass (or midpoint)

get_lower(t)[source]
get_midpoint(t)[source]
get_upper(t)[source]
location

Pertubation function that affects the location of the membership function

location_params

Parameters for location pertubation function

membership(x, t)[source]

Calculate the membership value of a given input

Parameters
  • x – input value

  • t – time displacement or perturbation parameters

Returns

membership value of x at this fuzzy set

name: str

The fuzzy set name

noise

Pertubation function that adds noise on the membership function

noise_params

Parameters for noise pertubation function

parameters: list

The parameters of the membership function

perform_location(t, param)[source]
perform_width(t, param)[source]
perturbate_parameters(t)[source]
type: str

The fuzzy set type (common, composite, nonstationary, etc)

width

Pertubation function that affects the width of the membership function

width_params

Parameters for width pertubation function

pyFTS.models.nonstationary.common.check_bounds(data, partitioner, t)[source]
pyFTS.models.nonstationary.common.check_bounds_index(data, partitioner, t)[source]
pyFTS.models.nonstationary.common.fuzzify(inst, t, fuzzySets)[source]

Calculate the membership values for a data point given nonstationary fuzzy sets

Parameters
  • inst – data points

  • t – time displacement of the instance

  • fuzzySets – list of fuzzy sets

Returns

array of membership values

pyFTS.models.nonstationary.common.fuzzySeries(data, fuzzySets, ordered_sets, window_size=1, method='fuzzy', const_t=None)[source]
pyFTS.models.nonstationary.common.window_index(t, window_size)[source]

pyFTS.models.nonstationary.cvfts module

class pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS(**kwargs)[source]

Bases: pyFTS.models.hofts.HighOrderFTS

alpha_cut: float

A float with the minimal membership to be considered on fuzzyfication process

auto_update: bool

A boolean value indicating that model is incremental

benchmark_only: bool

A boolean value indicating a façade for external (non-FTS) model used on benchmarks or ensembles.

detail: str

A string with the model detailed information

dump: bool
flrgs: dict

The list of Fuzzy Logical Relationship Groups - FLRG

forecast(ndata, **kwargs)[source]

Point forecast one step ahead

Parameters
  • data – time series data with the minimal length equal to the max_lag of the model

  • kwargs – model specific parameters

Returns

a list with the forecasted values

forecast_interval(ndata, **kwargs)[source]

Interval forecast one step ahead

Parameters
  • data – time series data with the minimal length equal to the max_lag of the model

  • kwargs – model specific parameters

Returns

a list with the prediction intervals

generate_flrg(flrs, **kwargs)[source]
has_interval_forecasting: bool

A boolean value indicating if the model supports interval forecasting, default: False

has_point_forecasting: bool

A boolean value indicating if the model supports point forecasting, default: True

has_probability_forecasting: bool

A boolean value indicating if the model support probabilistic forecasting, default: False

has_seasonality: bool

A boolean value indicating if the model supports seasonal indexers, default: False

is_clustered: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), but works like a monovariate method, default: False

is_high_order: bool

A boolean value indicating if the model support orders greater than 1, default: False

is_multivariate: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), default: False

is_time_variant: bool

A boolean value indicating if this model is time variant

is_wrapper: bool

Indicates that this model is a wrapper for other(s) method(s)

lags: list[int]

The list of lag indexes for high order models

log: pd.DataFrame
max_lag: int

A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags needed to forecast a single step ahead

min_order: int

In high order models, this integer value indicates the minimal order supported for the model, default: 1

name: str

A string with the model name

order: int

A integer with the model order (number of past lags are used on forecasting)

original_max: float

A float with the upper limit of the Universe of Discourse, the maximal value found on training data

original_min: float

A float with the lower limit of the Universe of Discourse, the minimal value found on training data

partitioner: partitioner.Partitioner

A pyFTS.partitioners.Partitioner object with the Universe of Discourse partitioner used on the model. This is a mandatory dependecy.

perturbation_factors(data, **kwargs)[source]
perturbation_factors__old(data)[source]
shortname: str

A string with a short name or alias for the model

standard_horizon: int

Standard forecasting horizon (Default: 1)

train(ndata, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

transformations: list[transformation.Transformation]

A list with the data transformations (common.Transformations) applied on model pre and post processing, default: []

transformations_param: list

A list with the specific parameters for each data transformation

uod_clip: bool

Flag indicating if the test data will be clipped inside the training Universe of Discourse

class pyFTS.models.nonstationary.cvfts.HighOrderNonstationaryFLRG(order, **kwargs)[source]

Bases: pyFTS.models.hofts.HighOrderFTS

Conventional High Order Fuzzy Logical Relationship Group

alpha_cut: float

A float with the minimal membership to be considered on fuzzyfication process

append_lhs(c)[source]
append_rhs(c, **kwargs)[source]
auto_update: bool

A boolean value indicating that model is incremental

benchmark_only: bool

A boolean value indicating a façade for external (non-FTS) model used on benchmarks or ensembles.

detail: str

A string with the model detailed information

dump: bool
flrgs: dict

The list of Fuzzy Logical Relationship Groups - FLRG

has_interval_forecasting: bool

A boolean value indicating if the model supports interval forecasting, default: False

has_point_forecasting: bool

A boolean value indicating if the model supports point forecasting, default: True

has_probability_forecasting: bool

A boolean value indicating if the model support probabilistic forecasting, default: False

has_seasonality: bool

A boolean value indicating if the model supports seasonal indexers, default: False

is_clustered: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), but works like a monovariate method, default: False

is_high_order: bool

A boolean value indicating if the model support orders greater than 1, default: False

is_multivariate: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), default: False

is_time_variant: bool

A boolean value indicating if this model is time variant

is_wrapper: bool

Indicates that this model is a wrapper for other(s) method(s)

lags: list[int]

The list of lag indexes for high order models

log: pd.DataFrame
max_lag: int

A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags needed to forecast a single step ahead

min_order: int

In high order models, this integer value indicates the minimal order supported for the model, default: 1

name: str

A string with the model name

order: int

A integer with the model order (number of past lags are used on forecasting)

original_max: float

A float with the upper limit of the Universe of Discourse, the maximal value found on training data

original_min: float

A float with the lower limit of the Universe of Discourse, the minimal value found on training data

partitioner: partitioner.Partitioner

A pyFTS.partitioners.Partitioner object with the Universe of Discourse partitioner used on the model. This is a mandatory dependecy.

shortname: str

A string with a short name or alias for the model

standard_horizon: int

Standard forecasting horizon (Default: 1)

transformations: list[transformation.Transformation]

A list with the data transformations (common.Transformations) applied on model pre and post processing, default: []

transformations_param: list

A list with the specific parameters for each data transformation

uod_clip: bool

Flag indicating if the test data will be clipped inside the training Universe of Discourse

pyFTS.models.nonstationary.flrg module

class pyFTS.models.nonstationary.flrg.NonStationaryFLRG(LHS, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

get_key()[source]

Returns a unique identifier for this FLRG

get_lower(*args)[source]

Returns the lower bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

lower bound value

get_membership(data, *args)[source]

Returns the membership value of the FLRG for the input data

Parameters
  • data – input data

  • sets – fuzzy sets

Returns

the membership value

get_midpoint(*args)[source]

Returns the midpoint value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

the midpoint value

get_upper(*args)[source]

Returns the upper bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

upper bound value

unpack_args(*args)[source]

pyFTS.models.nonstationary.honsfts module

class pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFLRG(order, **kwargs)[source]

Bases: pyFTS.models.nonstationary.flrg.NonStationaryFLRG

First Order NonStationary Fuzzy Logical Relationship Group

append_lhs(c)[source]
append_rhs(fset, **kwargs)[source]
get_lower(sets, perturb)[source]

Returns the lower bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

lower bound value

get_midpoint(sets, perturb)[source]

Returns the midpoint value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

the midpoint value

get_upper(sets, perturb)[source]

Returns the upper bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

upper bound value

weights()[source]
class pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFTS(**kwargs)[source]

Bases: pyFTS.models.nonstationary.nsfts.NonStationaryFTS

NonStationaryFTS Fuzzy Time Series

alpha_cut: float

A float with the minimal membership to be considered on fuzzyfication process

auto_update: bool

A boolean value indicating that model is incremental

benchmark_only: bool

A boolean value indicating a façade for external (non-FTS) model used on benchmarks or ensembles.

configure_lags(**kwargs)[source]
detail: str

A string with the model detailed information

dump: bool
flrgs: dict

The list of Fuzzy Logical Relationship Groups - FLRG

forecast(ndata, **kwargs)[source]

Point forecast one step ahead

Parameters
  • data – time series data with the minimal length equal to the max_lag of the model

  • kwargs – model specific parameters

Returns

a list with the forecasted values

generate_flrg(data, **kwargs)[source]
has_interval_forecasting: bool

A boolean value indicating if the model supports interval forecasting, default: False

has_point_forecasting: bool

A boolean value indicating if the model supports point forecasting, default: True

has_probability_forecasting: bool

A boolean value indicating if the model support probabilistic forecasting, default: False

has_seasonality: bool

A boolean value indicating if the model supports seasonal indexers, default: False

is_clustered: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), but works like a monovariate method, default: False

is_high_order: bool

A boolean value indicating if the model support orders greater than 1, default: False

is_multivariate: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), default: False

is_time_variant: bool

A boolean value indicating if this model is time variant

is_wrapper: bool

Indicates that this model is a wrapper for other(s) method(s)

lags: list[int]

The list of lag indexes for high order models

log: pd.DataFrame
max_lag: int

A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags needed to forecast a single step ahead

min_order: int

In high order models, this integer value indicates the minimal order supported for the model, default: 1

name: str

A string with the model name

order: int

A integer with the model order (number of past lags are used on forecasting)

original_max: float

A float with the upper limit of the Universe of Discourse, the maximal value found on training data

original_min: float

A float with the lower limit of the Universe of Discourse, the minimal value found on training data

partitioner: partitioner.Partitioner

A pyFTS.partitioners.Partitioner object with the Universe of Discourse partitioner used on the model. This is a mandatory dependecy.

shortname: str

A string with a short name or alias for the model

standard_horizon: int

Standard forecasting horizon (Default: 1)

train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

transformations: list[transformation.Transformation]

A list with the data transformations (common.Transformations) applied on model pre and post processing, default: []

transformations_param: list

A list with the specific parameters for each data transformation

uod_clip: bool

Flag indicating if the test data will be clipped inside the training Universe of Discourse

pyFTS.models.nonstationary.nsfts module

class pyFTS.models.nonstationary.nsfts.ConventionalNonStationaryFLRG(LHS, **kwargs)[source]

Bases: pyFTS.models.nonstationary.flrg.NonStationaryFLRG

First Order NonStationary Fuzzy Logical Relationship Group

append_rhs(c, **kwargs)[source]
get_key()[source]

Returns a unique identifier for this FLRG

class pyFTS.models.nonstationary.nsfts.NonStationaryFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

NonStationaryFTS Fuzzy Time Series

alpha_cut: float

A float with the minimal membership to be considered on fuzzyfication process

auto_update: bool

A boolean value indicating that model is incremental

benchmark_only: bool

A boolean value indicating a façade for external (non-FTS) model used on benchmarks or ensembles.

conditional_perturbation_factors(data, **kwargs)[source]
detail: str

A string with the model detailed information

dump: bool
flrgs: dict

The list of Fuzzy Logical Relationship Groups - FLRG

forecast(ndata, **kwargs)[source]

Point forecast one step ahead

Parameters
  • data – time series data with the minimal length equal to the max_lag of the model

  • kwargs – model specific parameters

Returns

a list with the forecasted values

forecast_interval(ndata, **kwargs)[source]

Interval forecast one step ahead

Parameters
  • data – time series data with the minimal length equal to the max_lag of the model

  • kwargs – model specific parameters

Returns

a list with the prediction intervals

generate_flrg(flrs, **kwargs)[source]
has_interval_forecasting: bool

A boolean value indicating if the model supports interval forecasting, default: False

has_point_forecasting: bool

A boolean value indicating if the model supports point forecasting, default: True

has_probability_forecasting: bool

A boolean value indicating if the model support probabilistic forecasting, default: False

has_seasonality: bool

A boolean value indicating if the model supports seasonal indexers, default: False

is_clustered: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), but works like a monovariate method, default: False

is_high_order: bool

A boolean value indicating if the model support orders greater than 1, default: False

is_multivariate: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), default: False

is_time_variant: bool

A boolean value indicating if this model is time variant

is_wrapper: bool

Indicates that this model is a wrapper for other(s) method(s)

lags: list[int]

The list of lag indexes for high order models

log: pd.DataFrame
max_lag: int

A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags needed to forecast a single step ahead

min_order: int

In high order models, this integer value indicates the minimal order supported for the model, default: 1

name: str

A string with the model name

order: int

A integer with the model order (number of past lags are used on forecasting)

original_max: float

A float with the upper limit of the Universe of Discourse, the maximal value found on training data

original_min: float

A float with the lower limit of the Universe of Discourse, the minimal value found on training data

partitioner: partitioner.Partitioner

A pyFTS.partitioners.Partitioner object with the Universe of Discourse partitioner used on the model. This is a mandatory dependecy.

shortname: str

A string with a short name or alias for the model

standard_horizon: int

Standard forecasting horizon (Default: 1)

train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

transformations: list[transformation.Transformation]

A list with the data transformations (common.Transformations) applied on model pre and post processing, default: []

transformations_param: list

A list with the specific parameters for each data transformation

uod_clip: bool

Flag indicating if the test data will be clipped inside the training Universe of Discourse

class pyFTS.models.nonstationary.nsfts.WeightedNonStationaryFLRG(LHS, **kwargs)[source]

Bases: pyFTS.models.nonstationary.flrg.NonStationaryFLRG

First Order NonStationary Fuzzy Logical Relationship Group

append_rhs(c, **kwargs)[source]
get_key()[source]

Returns a unique identifier for this FLRG

get_midpoint(sets, perturb)[source]

Returns the midpoint value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

the midpoint value

weights()[source]
class pyFTS.models.nonstationary.nsfts.WeightedNonStationaryFTS(**kwargs)[source]

Bases: pyFTS.models.nonstationary.nsfts.NonStationaryFTS

Weighted NonStationaryFTS Fuzzy Time Series

alpha_cut: float

A float with the minimal membership to be considered on fuzzyfication process

auto_update: bool

A boolean value indicating that model is incremental

benchmark_only: bool

A boolean value indicating a façade for external (non-FTS) model used on benchmarks or ensembles.

detail: str

A string with the model detailed information

dump: bool
flrgs: dict

The list of Fuzzy Logical Relationship Groups - FLRG

generate_flrg(flrs, **kwargs)[source]
has_interval_forecasting: bool

A boolean value indicating if the model supports interval forecasting, default: False

has_point_forecasting: bool

A boolean value indicating if the model supports point forecasting, default: True

has_probability_forecasting: bool

A boolean value indicating if the model support probabilistic forecasting, default: False

has_seasonality: bool

A boolean value indicating if the model supports seasonal indexers, default: False

is_clustered: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), but works like a monovariate method, default: False

is_high_order: bool

A boolean value indicating if the model support orders greater than 1, default: False

is_multivariate: bool

A boolean value indicating if the model support multivariate time series (Pandas DataFrame), default: False

is_time_variant: bool

A boolean value indicating if this model is time variant

is_wrapper: bool

Indicates that this model is a wrapper for other(s) method(s)

lags: list[int]

The list of lag indexes for high order models

log: pd.DataFrame
max_lag: int

A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags needed to forecast a single step ahead

min_order: int

In high order models, this integer value indicates the minimal order supported for the model, default: 1

name: str

A string with the model name

order: int

A integer with the model order (number of past lags are used on forecasting)

original_max: float

A float with the upper limit of the Universe of Discourse, the maximal value found on training data

original_min: float

A float with the lower limit of the Universe of Discourse, the minimal value found on training data

partitioner: partitioner.Partitioner

A pyFTS.partitioners.Partitioner object with the Universe of Discourse partitioner used on the model. This is a mandatory dependecy.

shortname: str

A string with a short name or alias for the model

standard_horizon: int

Standard forecasting horizon (Default: 1)

train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

transformations: list[transformation.Transformation]

A list with the data transformations (common.Transformations) applied on model pre and post processing, default: []

transformations_param: list

A list with the specific parameters for each data transformation

uod_clip: bool

Flag indicating if the test data will be clipped inside the training Universe of Discourse

pyFTS.models.nonstationary.partitioners module

class pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner(data, part, **kwargs)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Non Stationary Universe of Discourse Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

get_polynomial_perturbations(data, **kwargs)[source]
poly_width(par1, par2, rng, deg)[source]
scale_down(x, pct)[source]
scale_up(x, pct)[source]
class pyFTS.models.nonstationary.partitioners.SimpleNonStationaryPartitioner(data, part, **kwargs)[source]

Bases: pyFTS.partitioners.partitioner.Partitioner

Non Stationary Universe of Discourse Partitioner

build(data)[source]

Perform the partitioning of the Universe of Discourse

Parameters

data – training data

Returns

pyFTS.models.nonstationary.partitioners.simplenonstationary_gridpartitioner_builder(data, npart, transformation)[source]

pyFTS.models.nonstationary.perturbation module

Pertubation functions for Non Stationary Fuzzy Sets

pyFTS.models.nonstationary.perturbation.exponential(x, parameters)[source]
pyFTS.models.nonstationary.perturbation.linear(x, parameters)[source]
pyFTS.models.nonstationary.perturbation.periodic(x, parameters)[source]
pyFTS.models.nonstationary.perturbation.polynomial(x, parameters)[source]

pyFTS.models.nonstationary.util module

pyFTS.models.nonstationary.util.plot_sets(partitioner, start=0, end=10, step=1, tam=[5, 5], colors=None, save=False, file=None, axes=None, data=None, window_size=1, only_lines=False, legend=True)[source]
pyFTS.models.nonstationary.util.plot_sets_conditional(model, data, step=1, size=[5, 5], colors=None, save=False, file=None, axes=None, fig=None)[source]

Module contents

Fuzzy time series with nonstationary fuzzy sets, for heteroskedastic data