diff --git a/pyFTS/models/pwfts.py b/pyFTS/models/pwfts.py index b3d381d..95880a1 100644 --- a/pyFTS/models/pwfts.py +++ b/pyFTS/models/pwfts.py @@ -517,7 +517,10 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS): 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): diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index 918f410..45c8521 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -8,40 +8,44 @@ import matplotlib.pylab as plt import pandas as pd -from pyFTS.common import Util as cUtil, FuzzySet -from pyFTS.partitioners import Grid, Entropy, Util as pUtil, Simple -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.ensemble import ensemble +#from pyFTS.common import Util as cUtil, FuzzySet +from pyFTS.partitioners import Grid #, Entropy, Util as pUtil, Simple +#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 pwfts +#from pyFTS.models.ensemble import ensemble from pyFTS.common import Transformations, Membership, Util -from pyFTS.benchmarks import arima, quantreg #BSTS, gaussianproc, knn -from pyFTS.fcm import fts, common, GA -from pyFTS.common import Transformations +#from pyFTS.benchmarks import arima, quantreg #BSTS, gaussianproc, knn +#from pyFTS.fcm import fts, common, GA +#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['temperature'].values +#dados = df['temperature'].values #dados = dados.flatten().tolist() +dados = Enrollments.get_data() + l = len(dados) -dados_treino = dados[:int(l*.7)] -dados_teste = dados[int(l*.7):] +#dados_treino = 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) # 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)