Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13981

Arima model predicitons are not correct

$
0
0

Im working on a project in which im trying to make an ARIMA model in python tht predicts future Stock / Crypto prices. it turns out that the code is functional but when i plot the "Predicitions". it looks like a parabolic chart. Im a noob in neural networks.

the following code is the main AI

import pandas as pdimport numpy as npfrom statsmodels.tsa.arima.model import ARIMAfrom statsmodels.tsa.arima_model import ARIMAResultsdata = pd.read_csv("/content/datastock.csv")time_series = pd.Series(data['prices'])train_data = time_series[:int(0.8 * len(time_series))]test_data = time_series[int(0.8 * len(time_series)):]model = ARIMA(train_data, order=(7, 0, 7))model_fit = model.fit()predictions = model_fit.predict(start=len(train_data), end=len(train_data) + len(test_data) - 1)print(model_fit.summary())print("Predicted prices:")print(predictions)e = np.mean((predictions - test_data) ** 2)print("E", e)model_fit.save("/usr/model.pkl")

and this is the code i wrote in order to load my Model :

import picklefrom statsmodels.tsa.arima.model import ARIMAfrom datetime import datetime, timedeltaimport matplotlib.pyplot as pltwith open('/usr/model.pkl', 'rb') as file:    arima_model = pickle.load(file)predictions = arima_model.forecast(steps = 100)plt.plot(predictions)plt.showprint(predictions)

i will appreciate any help

i tried changing the P, D and Q attributes of the ARIMA model. but it does not quite work as i expected.It just adds some bumps in the chart.


Viewing all articles
Browse latest Browse all 13981

Trending Articles