Comments (4)
Hi, thanks to get in touch!
To answer your questions I need to know which partitioner, how many partitions, which model with which model's parameters did you used on this experiment.
Can you share the code & data for reproduction?
from pyfts.
Thank you for your response.
I use the grid partitioner. the codes are shown below:
from pyFTS.partitioners import Grid, Util as pUtil
fig, ax = plt.subplots(nrows=2, ncols=3, figsize=[20,5])
partitioners = {}
partitioners_diff = {}
for count,dataset_name in enumerate(dataset_names):
dataset = get_dataset(dataset_name)
partitioner = Grid.GridPartitioner(data=dataset, npart=30)
partitioners[dataset_name] = partitioner
partitioner_diff = Grid.GridPartitioner(data=dataset, npart=30, transformation=tdiff)
partitioners_diff[dataset_name] = partitioner_diff
pUtil.plot_sets(dataset, [partitioner.sets], titles=[dataset_name], axis=ax[0][count])
pUtil.plot_sets(dataset, [partitioner_diff.sets], titles=[''], axis=ax[1][count])
Then I train the model with original data(TAIEX)
from pyFTS.models import yu
for count,dataset_name in enumerate(dataset_names):
dataset = get_dataset(dataset_name)
model1 = chen.ConventionalFTS(partitioner=partitioners[dataset_name])
model1.name=dataset_name
model1.fit(dataset[:train_split], save_model=True, file_path='model1'+dataset_name, order=1)
After that, I want to make multi-steps ahead prediction by making one-step prediction first, then use the previous prediction to make the next-step prediction. The prediction codes are shown below:
fig, ax = plt.subplots(nrows=3, ncols=1, figsize=[20,10])
forecasts = []
for count,dataset_name in enumerate(dataset_names):
dataset = get_dataset(dataset_name)
ax[count].plot(dataset[train_split:train_split+200])
model1 = cUtil.load_obj('model1'+dataset_name)
prev_forecasts = dataset[train_split-1:train_split]
for n in range(200):
new_forecast = model1.predict(prev_forecasts[n:n+1])
prev_forecasts = np.append(prev_forecasts,new_forecast)
#forecasts = model1.predict(dataset[train_split:train_split+1])
forecasts = prev_forecasts
ax[count].plot(forecasts)
ax[count].set_title(dataset_name)
plt.tight_layout()
So in this library, the one-step prediction is based on the true data of previous day, even in the test process? Am I right?
Looking forward to your reply!
from pyfts.
Hi, thanks to get in touch!
To answer your questions I need to know which partitioner, how many partitions, which model with which model's parameters did you used on this experiment.
Can you share the code & data for reproduction?
Thank you for your response.
I use the grid partitioner. the codes are shown below:
from pyFTS.partitioners import Grid, Util as pUtil
fig, ax = plt.subplots(nrows=2, ncols=3, figsize=[20,5])
partitioners = {}
partitioners_diff = {}
for count,dataset_name in enumerate(dataset_names):
dataset = get_dataset(dataset_name)
partitioner = Grid.GridPartitioner(data=dataset, npart=30)
partitioners[dataset_name] = partitioner
partitioner_diff = Grid.GridPartitioner(data=dataset, npart=30, transformation=tdiff)
partitioners_diff[dataset_name] = partitioner_diff
pUtil.plot_sets(dataset, [partitioner.sets], titles=[dataset_name], axis=ax[0][count])
pUtil.plot_sets(dataset, [partitioner_diff.sets], titles=[''], axis=ax[1][count])
Then I train the model with original data(TAIEX)
from pyFTS.models import yu
for count,dataset_name in enumerate(dataset_names):
dataset = get_dataset(dataset_name)
model1 = chen.ConventionalFTS(partitioner=partitioners[dataset_name])
model1.name=dataset_name
model1.fit(dataset[:train_split], save_model=True, file_path='model1'+dataset_name, order=1)
After that, I want to make multi-steps ahead prediction by making one-step prediction first, then use the previous prediction to make the next-step prediction. The prediction codes are shown below:
fig, ax = plt.subplots(nrows=3, ncols=1, figsize=[20,10])
forecasts = []
for count,dataset_name in enumerate(dataset_names):
dataset = get_dataset(dataset_name)
ax[count].plot(dataset[train_split:train_split+200])
model1 = cUtil.load_obj('model1'+dataset_name)
prev_forecasts = dataset[train_split-1:train_split]
for n in range(200):
new_forecast = model1.predict(prev_forecasts[n:n+1])
prev_forecasts = np.append(prev_forecasts,new_forecast)
#forecasts = model1.predict(dataset[train_split:train_split+1])
forecasts = prev_forecasts
ax[count].plot(forecasts)
ax[count].set_title(dataset_name)
plt.tight_layout()
The results are not good.
image
So in this library, the one-step prediction is based on the true data of previous day, even in the test process? Am I right?
Looking forward to your reply!
from pyfts.
Some tips:
- The Chen method is old and outdated. Try newer methods ans Yu, Cheng, HOFTS, etc.
- The correct way to forecast many steps ahead is model.predict(input_data, steps_ahead=n)
- Many steps ahead forecasting will, for long time horizons, decay to the time series expected value (or mean). The mean of word "long" depends on the stationarity and distribution of the data.
- I recommend the reading of the second part of the tutorial: https://towardsdatascience.com/a-short-tutorial-on-fuzzy-time-series-part-ii-with-an-case-study-on-solar-energy-bda362ecca6d
from pyfts.
Related Issues (20)
- Question on generators parameter HOT 1
- Bug in binary search HOT 1
- Multi-variate high order FTS model HOT 2
- How the predict function works? HOT 8
- Performance of HOFTS on erratic dataset.
- forecasting algorithms HOT 1
- Look ahead bias in performance measure? HOT 1
- Partitioner.fuzzyfy cannot handle parameters mode='vector' and method='maximum' HOT 3
- One step forecasting HOT 2
- Defining the membership function HOT 2
- how to use hyperparams HOT 6
- Unable to get data
- Can we predict the data out of the sample?
- will it work for multivariate time series prediction both regression and classification HOT 1
- how to use mvts for prediction
- Fuzzyfication with Huarng Partitioner not woking (with fix for this)
- How to calculate rmse and mape
- Plot of Forecasted vs Actual misrepresenting the fit by not inserting None at right index?
- [MAJOR ISSUE] Error in the Calculation of Inverse Transformations for model.predict()
- `np.int` was a deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyfts.