# pyFTS.models package

## Module contents

Fuzzy Time Series methods

## Subpackages

- pyFTS.models.ensemble package
  - Submodules
  - pyFTS.models.ensemble.ensemble module
  - pyFTS.models.ensemble.multiseasonal module
  - Module contents
- pyFTS.models.incremental package
  - Module contents
  - Submodules
  - pyFTS.models.incremental.TimeVariant module
  - pyFTS.models.incremental.IncrementalEnsemble module
- pyFTS.models.multivariate package
  - Module contents
  - Submodules
  - pyFTS.models.multivariate.FLR module
  - pyFTS.models.multivariate.common module
  - pyFTS.models.multivariate.variable module
  - pyFTS.models.multivariate.flrg module
  - pyFTS.models.multivariate.partitioner module
  - pyFTS.models.multivariate.grid module
  - pyFTS.models.multivariate.mvfts module
  - pyFTS.models.multivariate.wmvfts module
  - pyFTS.models.multivariate.cmvfts module
  - pyFTS.models.multivariate.granular module
- pyFTS.models.nonstationary package
  - Submodules
  - pyFTS.models.nonstationary.common module
  - pyFTS.models.nonstationary.cvfts module
  - pyFTS.models.nonstationary.flrg module
  - pyFTS.models.nonstationary.honsfts module
  - pyFTS.models.nonstationary.nsfts module
  - pyFTS.models.nonstationary.partitioners module
  - pyFTS.models.nonstationary.perturbation module
  - pyFTS.models.nonstationary.util module
  - Module contents
- pyFTS.models.seasonal package
  - Submodules
  - pyFTS.models.seasonal.SeasonalIndexer module
  - pyFTS.models.seasonal.cmsfts module
  - pyFTS.models.seasonal.common module
  - pyFTS.models.seasonal.msfts module
  - pyFTS.models.seasonal.partitioner module
  - pyFTS.models.seasonal.sfts module
  - Module contents

## Submodules

## pyFTS.models.song module

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

17. 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)

  Bases: `pyFTS.common.fts.FTS`

  Traditional Fuzzy Time Series

  `flr_membership_matrix`(flr)
  `forecast`(ndata, **kwargs)

    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)
  `train`(data, **kwargs)

    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)

  Bases: `pyFTS.common.flrg.FLRG`

  First Order Conventional Fuzzy Logical Relationship Group

  `append_rhs`(c, **kwargs)
  `get_key`(sets)

    Returns a unique identifier for this FLRG

class `pyFTS.models.chen.``ConventionalFTS`(**kwargs)

  Bases: `pyFTS.common.fts.FTS`

  Conventional Fuzzy Time Series

  `forecast`(ndata, **kwargs)

    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)
  `train`(data, **kwargs)

    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)

  Bases: `pyFTS.common.flrg.FLRG`

  First Order Weighted Fuzzy Logical Relationship Group

  `append_rhs`(c, **kwargs)
  `weights`(sets)

class `pyFTS.models.yu.``WeightedFTS`(**kwargs)

  Bases: `pyFTS.common.fts.FTS`

  First Order Weighted Fuzzy Time Series

  `forecast`(ndata, **kwargs)

    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)
  `train`(ndata, **kwargs)

    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)

  Bases: `pyFTS.models.yu.WeightedFLRG`

  First Order Trend Weighted Fuzzy Logical Relationship Group

  `weights`(sets)

class `pyFTS.models.cheng.``TrendWeightedFTS`(**kwargs)

  Bases: `pyFTS.models.yu.WeightedFTS`

  First Order Trend Weighted Fuzzy Time Series

  `generate_FLRG`(flrs)

## 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)

  Bases: `pyFTS.common.flrg.FLRG`

  Conventional High Order Fuzzy Logical Relationship Group

  `append_lhs`(c)
  `append_rhs`(c, **kwargs)

class `pyFTS.models.hofts.``HighOrderFTS`(**kwargs)

  Bases: `pyFTS.common.fts.FTS`

  Conventional High Order Fuzzy Time Series

  `configure_lags`(**kwargs)
  `forecast`(ndata, **kwargs)

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

    Method specific parameter fitting

    Parameters

      - data – training time series data

      - kwargs – Method specific parameters

class `pyFTS.models.hofts.``WeightedHighOrderFLRG`(order, **kwargs)

  Bases: `pyFTS.common.flrg.FLRG`

  Weighted High Order Fuzzy Logical Relationship Group

  `append_lhs`(c)
  `append_rhs`(fset, **kwargs)
  `get_lower`(sets)

    Returns the lower bound value for the RHS fuzzy sets

    Parameters

      sets – fuzzy sets

    Returns

      lower bound value

  `get_midpoint`(sets)

    Returns the midpoint value for the RHS fuzzy sets

    Parameters

      sets – fuzzy sets

    Returns

      the midpoint value

  `get_upper`(sets)

    Returns the upper bound value for the RHS fuzzy sets

    Parameters

      sets – fuzzy sets

    Returns

      upper bound value

  `weights`()

class `pyFTS.models.hofts.``WeightedHighOrderFTS`(**kwargs)

  Bases: `pyFTS.models.hofts.HighOrderFTS`

  Weighted High Order Fuzzy Time Series

  `generate_lhs_flrg_fuzzyfied`(sample, explain=False)

## 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)

  Bases: `pyFTS.common.fts.FTS`

  `configure_lags`(**kwargs)
  `forecast`(ndata, **kwargs)

    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)

    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)

  Bases: `pyFTS.models.hofts.HighOrderFTS`

  High Order Interval Fuzzy Time Series

  `forecast_ahead_interval`(data, steps, **kwargs)

    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)

    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)
  `get_sequence_membership`(data, fuzzySets)
  `get_upper`(flrg)

class `pyFTS.models.ifts.``WeightedIntervalFTS`(**kwargs)

  Bases: `pyFTS.models.hofts.WeightedHighOrderFTS`

  Weighted High Order Interval Fuzzy Time Series

  `forecast_ahead_interval`(data, steps, **kwargs)

    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)

    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)
  `get_sequence_membership`(data, fuzzySets)
  `get_upper`(flrg)

## 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)

  Bases: `pyFTS.common.flrg.FLRG`

  First Order Improved Weighted Fuzzy Logical Relationship Group

  `append_rhs`(c, **kwargs)
  `weights`()

class `pyFTS.models.ismailefendi.``ImprovedWeightedFTS`(**kwargs)

  Bases: `pyFTS.common.fts.FTS`

  First Order Improved Weighted Fuzzy Time Series

  `forecast`(ndata, **kwargs)

    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)
  `train`(ndata, **kwargs)

    Method specific parameter fitting

    Parameters

      - data – training time series data

      - kwargs – Method specific parameters

## pyFTS.models.pwfts module

class `pyFTS.models.pwfts.``ProbabilisticWeightedFLRG`(order)

  Bases: `pyFTS.models.hofts.HighOrderFLRG`

  High Order Probabilistic Weighted Fuzzy Logical Relationship Group

  `append_rhs`(c, **kwargs)
  `get_lower`(sets)

    Returns the lower bound value for the RHS fuzzy sets

    Parameters

      sets – fuzzy sets

    Returns

      lower bound value

  `get_membership`(data, sets)

    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)

    Return the expectation of the PWFLRG, the weighted sum

  `get_upper`(sets)

    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)
  `lhs_conditional_probability_fuzzyfied`(lhs_mv, sets, norm, uod, nbins)
  `partition_function`(sets, uod, nbins=100)
  `rhs_conditional_probability`(x, sets, uod, nbins)
  `rhs_unconditional_probability`(c)

class `pyFTS.models.pwfts.``ProbabilisticWeightedFTS`(**kwargs)

  Bases: `pyFTS.models.ifts.IntervalFTS`

  High Order Probabilistic Weighted Fuzzy Time Series

  `add_new_PWFLGR`(flrg)
  `flrg_lhs_conditional_probability`(x, flrg)
  `flrg_lhs_conditional_probability_fuzzyfied`(x, flrg)
  `flrg_lhs_unconditional_probability`(flrg)
  `flrg_rhs_conditional_probability`(x, flrg)
  `forecast`(data, **kwargs)

    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)

    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)

    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)

    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)

    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)
  `forecast_interval`(ndata, **kwargs)

    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)
  `generate_flrg2`(data)
  `generate_flrg_fuzzyfied`(data)
  `generate_lhs_flrg`(sample, explain=False)
  `generate_lhs_flrg_fuzzyfied`(sample, explain=False)
  `get_lower`(flrg)
  `get_midpoint`(flrg)
  `get_sets_from_both_fuzzyfication`(sample)
  `get_upper`(flrg)
  `interval_heuristic`(sample, **kwargs)
  `interval_quantile`(ndata, alpha, **kwargs)
  `point_expected_value`(sample, **kwargs)
  `point_heuristic`(sample, **kwargs)
  `pwflrg_lhs_memberhip_fuzzyfied`(flrg, sample)
  `train`(data, **kwargs)

    Method specific parameter fitting

    Parameters

      - data – training time series data

      - kwargs – Method specific parameters

  `update_model`(data)

`pyFTS.models.pwfts.``visualize_distributions`(model, **kwargs)

## 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)

  Bases: `pyFTS.common.flrg.FLRG`

  First Order Exponentialy Weighted Fuzzy Logical Relationship Group

  `append_rhs`(c, **kwargs)
  `weights`()

class `pyFTS.models.sadaei.``ExponentialyWeightedFTS`(**kwargs)

  Bases: `pyFTS.common.fts.FTS`

  First Order Exponentialy Weighted Fuzzy Time Series

  `forecast`(ndata, **kwargs)

    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)
  `train`(data, **kwargs)

    Method specific parameter fitting

    Parameters

      - data – training time series data

      - kwargs – Method specific parameters