简体   繁体   中英

How to use a trained neural network model?

I can not understand how to use the already trained neural network model. I program on python, I use library keras. I analyze the time series. The neural network is trained, the model is saved.

As described in the keras documentation, you need to call the model_name.predict () method. Good. I do this: model.predict (dataset), where dataset are the values ​​for the last 90 days. And I need to get a prediction forward for, say, 10 days.

But the forecast is made only for the specified data set for 90 days! That is, you can only compare the original data and forecast.

So how do make a forecast for 10 days in advance from today?

After you saved your model, you need to load it whenever you want to use it. For Keras you load a model with

loaded_ model = keras.models.load_model( filepath )

Then you have to call the function

loaded_model.predict( dataset )

The dataset should be your data for the future 10 days and not the one for the past 90 days. If you pass the data for the past 90 days it will predict its outputs over that data.

My answer is based on the assumption your model uses a supervised learning algorithm and makes classification or regression tasks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM