Update trend.py

This commit is contained in:
Petrônio Cândido de Lima e Silva 2022-03-04 08:58:30 -03:00 committed by GitHub
parent c8f4513f5e
commit e72343e7a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,8 @@
from pyFTS.common.transformations.transformation import Transformation
from pandas import datetime
from sklearn.linear_model import LinearRegression
import numpy as np
import pandas as pd
class LinearTrend(Transformation):
@ -24,8 +28,6 @@ class LinearTrend(Transformation):
'''Regression model'''
def train(self, data, **kwargs):
from pandas import datetime
from sklearn.linear_model import LinearRegression
x = data[self.index_field].values
@ -79,4 +81,4 @@ class LinearTrend(Transformation):
ret = pd.Series(ret)
ret = pd.to_numeric(ret, downcast='integer')
return np.array(ret)
return np.array(ret)