Update trend.py
This commit is contained in:
parent
c8f4513f5e
commit
e72343e7a3
@ -1,4 +1,8 @@
|
|||||||
from pyFTS.common.transformations.transformation import Transformation
|
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):
|
class LinearTrend(Transformation):
|
||||||
@ -24,8 +28,6 @@ class LinearTrend(Transformation):
|
|||||||
'''Regression model'''
|
'''Regression model'''
|
||||||
|
|
||||||
def train(self, data, **kwargs):
|
def train(self, data, **kwargs):
|
||||||
from pandas import datetime
|
|
||||||
from sklearn.linear_model import LinearRegression
|
|
||||||
|
|
||||||
x = data[self.index_field].values
|
x = data[self.index_field].values
|
||||||
|
|
||||||
@ -79,4 +81,4 @@ class LinearTrend(Transformation):
|
|||||||
ret = pd.Series(ret)
|
ret = pd.Series(ret)
|
||||||
ret = pd.to_numeric(ret, downcast='integer')
|
ret = pd.to_numeric(ret, downcast='integer')
|
||||||
|
|
||||||
return np.array(ret)
|
return np.array(ret)
|
||||||
|
Loading…
Reference in New Issue
Block a user