2017-02-05 02:40:27 +04:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf8 -*-
|
|
|
|
|
|
|
|
import os
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
|
|
|
import matplotlib as plt
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
from mpl_toolkits.mplot3d import Axes3D
|
|
|
|
|
2017-02-08 19:23:41 +04:00
|
|
|
import datetime
|
|
|
|
|
2017-02-05 02:40:27 +04:00
|
|
|
import pandas as pd
|
2017-02-08 19:23:41 +04:00
|
|
|
from pyFTS.partitioners import Grid, CMeans, FCM, Entropy
|
|
|
|
from pyFTS.common import FLR,FuzzySet,Membership,Transformations,Util
|
2017-02-05 02:40:27 +04:00
|
|
|
from pyFTS import fts,sfts
|
|
|
|
from pyFTS.models import msfts
|
|
|
|
from pyFTS.benchmarks import benchmarks as bchmk
|
|
|
|
from pyFTS.benchmarks import Measures
|
|
|
|
|
|
|
|
os.chdir("/home/petronio/dados/Dropbox/Doutorado/Disciplinas/AdvancedFuzzyTimeSeriesModels/")
|
|
|
|
|
2017-02-08 19:23:41 +04:00
|
|
|
sonda = pd.read_csv("DataSets/SONDA_BSB_MOD.csv", sep=";")
|
|
|
|
|
|
|
|
sonda['data'] = pd.to_datetime(sonda['data'])
|
2017-02-05 02:40:27 +04:00
|
|
|
|
|
|
|
sonda = sonda[:][527041:]
|
|
|
|
|
|
|
|
sonda.index = np.arange(0,len(sonda.index))
|
|
|
|
|
2017-02-08 19:23:41 +04:00
|
|
|
|
2017-02-05 02:40:27 +04:00
|
|
|
sonda_treino = sonda[:1051200]
|
|
|
|
sonda_teste = sonda[1051201:]
|
|
|
|
|
|
|
|
|
|
|
|
#res = bchmk.simpleSearch_RMSE(sonda_treino, sonda_teste,
|
|
|
|
# sfts.SeasonalFTS,np.arange(3,30),[1],parameters=1440,
|
|
|
|
# tam=[15,8], plotforecasts=False,elev=45, azim=40,
|
|
|
|
# save=False,file="pictures/sonda_sfts_error_surface", intervals=False)
|
|
|
|
|
|
|
|
from pyFTS.models.seasonal import SeasonalIndexer
|
|
|
|
from pyFTS.models import msfts
|
|
|
|
from pyFTS.common import FLR
|
|
|
|
|
2017-02-09 17:04:48 +04:00
|
|
|
partitions = ['grid','entropy']
|
2017-02-08 19:23:41 +04:00
|
|
|
|
2017-02-09 17:04:48 +04:00
|
|
|
indexers = ['m15','Mh','Mhm15']
|
2017-02-08 19:23:41 +04:00
|
|
|
|
2017-02-09 17:04:48 +04:00
|
|
|
models = []
|
|
|
|
ixs = []
|
2017-02-08 19:23:41 +04:00
|
|
|
|
2017-02-09 17:04:48 +04:00
|
|
|
sample = sonda_teste[0:4300]
|
2017-02-05 02:40:27 +04:00
|
|
|
|
2017-02-09 17:04:48 +04:00
|
|
|
for max_part in [10, 20, 30, 40, 50]:
|
|
|
|
for part in partitions:
|
|
|
|
for ind in indexers:
|
|
|
|
ix = Util.load_obj("models/sonda_ix_" + ind + ".pkl")
|
|
|
|
model = Util.load_obj("models/sonda_msfts_" + part + "_" + str(max_part) + "_" + ind + ".pkl")
|
|
|
|
model.shortname = part + "_" + str(max_part) + "_" + ind
|
2017-02-05 02:40:27 +04:00
|
|
|
|
2017-02-09 17:04:48 +04:00
|
|
|
models.append(model)
|
|
|
|
ixs.append(ix)
|
2017-02-05 02:40:27 +04:00
|
|
|
|
2017-02-24 20:29:55 +04:00
|
|
|
print(bchmk.print_point_statistics(sample, models, indexers=ixs))
|