Predicting future values with sklearn

Viewed 39

I am trying to use a sklearn model to make predictions for a future time, 2 or 3 weeks in the future for example. The thing is that when making the prediction it only does it for values ​​that I already have and I don't understand how to make it to also make the prediction for future values.

import pandas as pd
import numpy as np
import sklearn
from sklearn import linear_model, preprocessing
from sklearn.linear_model import HuberRegressor

data1 = pd.read_csv("data.csv")

data1 = df[["X", "Y", "Mag", "Prof", "Energy"]]

predict = "X"


X = np.array(data1.drop([predict], 1)) 
y = np.array(data1[predict]) 


x_train, x_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size = 0.2)


model = HuberRegressor()


model.fit(x_train, y_train)


predictionsLat = model.predict(x_test)


for a in range (len(predictionsLat)):
    b = round(predictionsLat[a], 6)
    print('prediction Value: ',b,'Real: ', y_test[a])

I also use the same code to predict the other values of my data.

0 Answers
Related