step_to parameter in predict function

This commit is contained in:
Petrônio Cândido 2020-11-23 16:22:41 -03:00
parent 4a05587485
commit 2d4785d053
2 changed files with 26 additions and 19 deletions

View File

@ -517,7 +517,10 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
start = kwargs.get('start_at', 0) start = kwargs.get('start_at', 0)
ret = data[start: start+self.max_lag].tolist() if isinstance(data, np.ndarray):
data = data.tolist()
ret = data[start: start+self.max_lag]
for k in np.arange(self.max_lag, steps+self.max_lag): for k in np.arange(self.max_lag, steps+self.max_lag):

View File

@ -8,40 +8,44 @@ import matplotlib.pylab as plt
import pandas as pd import pandas as pd
from pyFTS.common import Util as cUtil, FuzzySet #from pyFTS.common import Util as cUtil, FuzzySet
from pyFTS.partitioners import Grid, Entropy, Util as pUtil, Simple from pyFTS.partitioners import Grid #, Entropy, Util as pUtil, Simple
from pyFTS.benchmarks import benchmarks as bchmk, Measures #from pyFTS.benchmarks import benchmarks as bchmk, Measures
from pyFTS.models import chen, yu, cheng, ismailefendi, hofts, pwfts, tsaur, song, sadaei, ifts #from pyFTS.models import chen, yu, cheng, ismailefendi, hofts, pwfts, tsaur, song, sadaei, ifts
from pyFTS.models.ensemble import ensemble from pyFTS.models import pwfts
#from pyFTS.models.ensemble import ensemble
from pyFTS.common import Transformations, Membership, Util from pyFTS.common import Transformations, Membership, Util
from pyFTS.benchmarks import arima, quantreg #BSTS, gaussianproc, knn #from pyFTS.benchmarks import arima, quantreg #BSTS, gaussianproc, knn
from pyFTS.fcm import fts, common, GA #from pyFTS.fcm import fts, common, GA
from pyFTS.common import Transformations #from pyFTS.common import Transformations
from pyFTS.data import Enrollments
tdiff = Transformations.Differential(1) #tdiff = Transformations.Differential(1)
boxcox = Transformations.BoxCox(0) #boxcox = Transformations.BoxCox(0)
df = pd.read_csv('https://query.data.world/s/z2xo3t32pkl4mdzp63x6lyne53obmi') #df = pd.read_csv('https://query.data.world/s/z2xo3t32pkl4mdzp63x6lyne53obmi')
#dados = df.iloc[2710:2960 , 0:1].values # somente a 1 coluna sera usada #dados = df.iloc[2710:2960 , 0:1].values # somente a 1 coluna sera usada
dados = df['temperature'].values #dados = df['temperature'].values
#dados = dados.flatten().tolist() #dados = dados.flatten().tolist()
dados = Enrollments.get_data()
l = len(dados) l = len(dados)
dados_treino = dados[:int(l*.7)] #dados_treino = dados[:int(l*.7)]
dados_teste = dados[int(l*.7):] #dados_teste = dados[int(l*.7):]
particionador = Grid.GridPartitioner(data = dados_treino, npart = 15, func = Membership.trimf) particionador = Grid.GridPartitioner(data = dados, npart = 5, func = Membership.trimf)
modelo = pwfts.ProbabilisticWeightedFTS(partitioner = particionador, order = 2) modelo = pwfts.ProbabilisticWeightedFTS(partitioner = particionador, order = 1)
modelo.fit(dados_treino) modelo.fit(dados)
# print(modelo) # print(modelo)
# Todo o procedimento de inferência é feito pelo método predict # Todo o procedimento de inferência é feito pelo método predict
predicoes = modelo.predict(dados_teste, step_to=30) predicoes = modelo.predict(dados)
print(predicoes) print(predicoes)