pyFTS.models package

Module contents

Fuzzy Time Series methods

Submodules

pyFTS.models.song module

First Order Traditional Fuzzy Time Series method by Song & Chissom (1993)

  1. Song and B. S. Chissom, “Fuzzy time series and its models,” Fuzzy Sets Syst., vol. 54, no. 3, pp. 269–277, 1993.

class pyFTS.models.song.ConventionalFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

Traditional Fuzzy Time Series

flr_membership_matrix(flr)[source]
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

operation_matrix(flrs)[source]
train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

pyFTS.models.chen module

First Order Conventional Fuzzy Time Series by Chen (1996)

S.-M. Chen, “Forecasting enrollments based on fuzzy time series,” Fuzzy Sets Syst., vol. 81, no. 3, pp. 311–319, 1996.

class pyFTS.models.chen.ConventionalFLRG(LHS, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

First Order Conventional Fuzzy Logical Relationship Group

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

Returns a unique identifier for this FLRG

class pyFTS.models.chen.ConventionalFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

Conventional Fuzzy Time Series

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(flrs)[source]
train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

pyFTS.models.yu module

First Order Weighted Fuzzy Time Series by Yu(2005)

H.-K. Yu, “Weighted fuzzy time series models for TAIEX forecasting,” Phys. A Stat. Mech. its Appl., vol. 349, no. 3, pp. 609–624, 2005.

class pyFTS.models.yu.WeightedFLRG(LHS, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

First Order Weighted Fuzzy Logical Relationship Group

append_rhs(c, **kwargs)[source]
weights(sets)[source]
class pyFTS.models.yu.WeightedFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

First Order Weighted Fuzzy Time Series

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(flrs)[source]
train(ndata, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

pyFTS.models.cheng module

Trend Weighted Fuzzy Time Series by Cheng, Chen and Wu (2009)

C.-H. Cheng, Y.-S. Chen, and Y.-L. Wu, “Forecasting innovation diffusion of products using trend-weighted fuzzy time-series model,” Expert Syst. Appl., vol. 36, no. 2, pp. 1826–1832, 2009.

class pyFTS.models.cheng.TrendWeightedFLRG(LHS, **kwargs)[source]

Bases: pyFTS.models.yu.WeightedFLRG

First Order Trend Weighted Fuzzy Logical Relationship Group

weights(sets)[source]
class pyFTS.models.cheng.TrendWeightedFTS(**kwargs)[source]

Bases: pyFTS.models.yu.WeightedFTS

First Order Trend Weighted Fuzzy Time Series

generate_FLRG(flrs)[source]

pyFTS.models.hofts module

High Order FTS

Severiano, S. A. Jr; Silva, P. C. L.; Sadaei, H. J.; Guimarães, F. G. Very Short-term Solar Forecasting using Fuzzy Time Series. 2017 IEEE International Conference on Fuzzy Systems. DOI10.1109/FUZZ-IEEE.2017.8015732

class pyFTS.models.hofts.HighOrderFLRG(order, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

Conventional High Order Fuzzy Logical Relationship Group

append_lhs(c)[source]
append_rhs(c, **kwargs)[source]
class pyFTS.models.hofts.HighOrderFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

Conventional High Order Fuzzy Time Series

configure_lags(**kwargs)[source]
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)[source]
generate_flrg_fuzzyfied(data)[source]
generate_lhs_flrg(sample, explain=False)[source]
generate_lhs_flrg_fuzzyfied(sample, explain=False)[source]
train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

class pyFTS.models.hofts.WeightedHighOrderFLRG(order, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

Weighted High Order Fuzzy Logical Relationship Group

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

Returns the lower bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

lower bound value

get_midpoint(sets)[source]

Returns the midpoint value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

the midpoint value

get_upper(sets)[source]

Returns the upper bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

upper bound value

weights()[source]
class pyFTS.models.hofts.WeightedHighOrderFTS(**kwargs)[source]

Bases: pyFTS.models.hofts.HighOrderFTS

Weighted High Order Fuzzy Time Series

generate_lhs_flrg_fuzzyfied(sample, explain=False)[source]

pyFTS.models.hwang module

High Order Fuzzy Time Series by Hwang, Chen and Lee (1998)

Jeng-Ren Hwang, Shyi-Ming Chen, and Chia-Hoang Lee, “Handling forecasting problems using fuzzy time series,” Fuzzy Sets Syst., no. 100, pp. 217–228, 1998.

class pyFTS.models.hwang.HighOrderFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

configure_lags(**kwargs)[source]
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

train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

pyFTS.models.ifts module

High Order Interval Fuzzy Time Series

SILVA, Petrônio CL; SADAEI, Hossein Javedani; GUIMARÃES, Frederico Gadelha. Interval Forecasting with Fuzzy Time Series. In: Computational Intelligence (SSCI), 2016 IEEE Symposium Series on. IEEE, 2016. p. 1-8.

class pyFTS.models.ifts.IntervalFTS(**kwargs)[source]

Bases: pyFTS.models.hofts.HighOrderFTS

High Order Interval Fuzzy Time Series

forecast_ahead_interval(data, steps, **kwargs)[source]

Interval forecast from 1 to H steps ahead, where H is given by the steps parameter

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

  • steps – the number of steps ahead to forecast

  • start_at – in the multi step forecasting, the index of the data where to start forecasting (default: 0)

Returns

a list with the forecasted intervals

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

get_lower(flrg)[source]
get_sequence_membership(data, fuzzySets)[source]
get_upper(flrg)[source]
class pyFTS.models.ifts.WeightedIntervalFTS(**kwargs)[source]

Bases: pyFTS.models.hofts.WeightedHighOrderFTS

Weighted High Order Interval Fuzzy Time Series

forecast_ahead_interval(data, steps, **kwargs)[source]

Interval forecast from 1 to H steps ahead, where H is given by the steps parameter

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

  • steps – the number of steps ahead to forecast

  • start_at – in the multi step forecasting, the index of the data where to start forecasting (default: 0)

Returns

a list with the forecasted intervals

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

get_lower(flrg)[source]
get_sequence_membership(data, fuzzySets)[source]
get_upper(flrg)[source]

pyFTS.models.ismailefendi module

First Order Improved Weighted Fuzzy Time Series by Efendi, Ismail and Deris (2013)

R. Efendi, Z. Ismail, and M. M. Deris, “Improved weight Fuzzy Time Series as used in the exchange rates forecasting of US Dollar to Ringgit Malaysia,” Int. J. Comput. Intell. Appl., vol. 12, no. 1, p. 1350005, 2013.

class pyFTS.models.ismailefendi.ImprovedWeightedFLRG(LHS, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

First Order Improved Weighted Fuzzy Logical Relationship Group

append_rhs(c, **kwargs)[source]
weights()[source]
class pyFTS.models.ismailefendi.ImprovedWeightedFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

First Order Improved Weighted Fuzzy Time Series

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(flrs)[source]
train(ndata, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

pyFTS.models.pwfts module

class pyFTS.models.pwfts.ProbabilisticWeightedFLRG(order)[source]

Bases: pyFTS.models.hofts.HighOrderFLRG

High Order Probabilistic Weighted Fuzzy Logical Relationship Group

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

Returns the lower bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

lower bound value

get_membership(data, sets)[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(sets)[source]

Return the expectation of the PWFLRG, the weighted sum

get_upper(sets)[source]

Returns the upper bound value for the RHS fuzzy sets

Parameters

sets – fuzzy sets

Returns

upper bound value

lhs_conditional_probability(x, sets, norm, uod, nbins)[source]
lhs_conditional_probability_fuzzyfied(lhs_mv, sets, norm, uod, nbins)[source]
partition_function(sets, uod, nbins=100)[source]
rhs_conditional_probability(x, sets, uod, nbins)[source]
rhs_unconditional_probability(c)[source]
class pyFTS.models.pwfts.ProbabilisticWeightedFTS(**kwargs)[source]

Bases: pyFTS.models.ifts.IntervalFTS

High Order Probabilistic Weighted Fuzzy Time Series

add_new_PWFLGR(flrg)[source]
flrg_lhs_conditional_probability(x, flrg)[source]
flrg_lhs_conditional_probability_fuzzyfied(x, flrg)[source]
flrg_lhs_unconditional_probability(flrg)[source]
flrg_rhs_conditional_probability(x, flrg)[source]
forecast(data, **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_ahead(data, steps, **kwargs)[source]

Point forecast from 1 to H steps ahead, where H is given by the steps parameter

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

  • steps – the number of steps ahead to forecast (default: 1)

  • start_at – in the multi step forecasting, the index of the data where to start forecasting (default: 0)

Returns

a list with the forecasted values

forecast_ahead_distribution(ndata, steps, **kwargs)[source]

Probabilistic forecast from 1 to H steps ahead, where H is given by the steps parameter

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

  • steps – the number of steps ahead to forecast

  • start_at – in the multi step forecasting, the index of the data where to start forecasting (default: 0)

Returns

a list with the forecasted Probability Distributions

forecast_ahead_interval(data, steps, **kwargs)[source]

Interval forecast from 1 to H steps ahead, where H is given by the steps parameter

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

  • steps – the number of steps ahead to forecast

  • start_at – in the multi step forecasting, the index of the data where to start forecasting (default: 0)

Returns

a list with the forecasted intervals

forecast_distribution(ndata, **kwargs)[source]

Probabilistic 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 probabilistic.ProbabilityDistribution objects representing the forecasted Probability Distributions

forecast_distribution_from_distribution(previous_dist, smooth, uod, bins, **kwargs)[source]
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(data)[source]
generate_flrg2(data)[source]
generate_flrg_fuzzyfied(data)[source]
generate_lhs_flrg(sample, explain=False)[source]
generate_lhs_flrg_fuzzyfied(sample, explain=False)[source]
get_lower(flrg)[source]
get_midpoint(flrg)[source]
get_sets_from_both_fuzzyfication(sample)[source]
get_upper(flrg)[source]
interval_heuristic(sample, **kwargs)[source]
interval_quantile(ndata, alpha, **kwargs)[source]
point_expected_value(sample, **kwargs)[source]
point_heuristic(sample, **kwargs)[source]
pwflrg_lhs_memberhip_fuzzyfied(flrg, sample)[source]
train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters

update_model(data)[source]
pyFTS.models.pwfts.visualize_distributions(model, **kwargs)[source]

pyFTS.models.sadaei module

First Order Exponentialy Weighted Fuzzy Time Series by Sadaei et al. (2013)

H. J. Sadaei, R. Enayatifar, A. H. Abdullah, and A. Gani, “Short-term load forecasting using a hybrid model with a refined exponentially weighted fuzzy time series and an improved harmony search,” Int. J. Electr. Power Energy Syst., vol. 62, no. from 2005, pp. 118–129, 2014.

class pyFTS.models.sadaei.ExponentialyWeightedFLRG(LHS, **kwargs)[source]

Bases: pyFTS.common.flrg.FLRG

First Order Exponentialy Weighted Fuzzy Logical Relationship Group

append_rhs(c, **kwargs)[source]
weights()[source]
class pyFTS.models.sadaei.ExponentialyWeightedFTS(**kwargs)[source]

Bases: pyFTS.common.fts.FTS

First Order Exponentialy Weighted Fuzzy Time Series

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(flrs, c)[source]
train(data, **kwargs)[source]

Method specific parameter fitting

Parameters
  • data – training time series data

  • kwargs – Method specific parameters