0% found this document useful (0 votes)
115 views

A Short Tutorial On Fuzzy Time Series - Part I

The document introduces fuzzy time series (FTS), a method for time series forecasting that uses fuzzy set theory. It discusses fuzzy sets and fuzzy rules, shows how to partition time series data into fuzzy sets, and demonstrates building and using an FTS model to forecast enrollment data. The Python library pyFTS is used to implement the FTS method and generate forecasts.

Uploaded by

Teto Schedule
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
115 views

A Short Tutorial On Fuzzy Time Series - Part I

The document introduces fuzzy time series (FTS), a method for time series forecasting that uses fuzzy set theory. It discusses fuzzy sets and fuzzy rules, shows how to partition time series data into fuzzy sets, and demonstrates building and using an FTS model to forecast enrollment data. The Python library pyFTS is used to implement the FTS method and generate forecasts.

Uploaded by

Teto Schedule
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

1 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

2 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

∈ℝ

3 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

def triangular(x, a, b, c):


return max( min( (x-a)/(b-a), (c-x)/(c-b) ), 0 )

Linguistic Term A B C
Very Small 25 25.1 50
Small 25 50 75
Short 50 90 130
Medium 90 130 175
Tall 130 175 220
Very Tall 175 220 220.1

4 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

5 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

α ε α
ε
ε 𝓝

α α ε

6 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

7 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

8 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

9 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

Year Enrollments
1971 13055
1972 13563
1973 13867
1974 14696
1975 15460
1976 15311
1977 15603
1978 15861
1979 16807
1980 16919
1981 16388
1982 15433
1983 15497
1984 15145
1985 15163
1986 15984
1987 16859
1988 18150
1989 18970
1990 19328

10 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...


11 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

→ → → → → → →






→ ∈

12 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

13 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

from pyFTS.data import Enrollments

train = Enrollments.get_data()

14 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

from pyFTS.common import Transformations


tdiff = Transformations.Differential(1)

from pyFTS.partitioners import Grid, Entropy, Util as


pUtil

fs = Grid.GridPartitioner(data=train, npart=20)

print(fs)

15 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

from pyFTS.models import chen

model = chen.ConventionalFTS(partitioner=fs)
model.fit(train)

print(model)

forecasts = model.predict(test)

16 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

17 of 18 7/5/2021, 2:34 PM
A short tutorial on Fuzzy Time Series | by Petrônio Silva | To... https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time...

18 of 18 7/5/2021, 2:34 PM

You might also like