pyFTS/tests/pfts.py

61 lines
1.7 KiB
Python
Raw Normal View History

#!/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
import pandas as pd
from pyFTS.partitioners import Grid
from pyFTS.common import FLR,FuzzySet,Membership,Transformations
from pyFTS import fts,hofts,ifts,pfts,tree, chen
from pyFTS.benchmarks import benchmarks as bchmk
2017-02-01 20:54:37 +04:00
from pyFTS.benchmarks import Measures
from numpy import random
gauss_treino = random.normal(0,1.0,1600)
gauss_teste = random.normal(0,1.0,400)
os.chdir("/home/petronio/dados/Dropbox/Doutorado/Disciplinas/AdvancedFuzzyTimeSeriesModels/")
2017-02-01 20:54:37 +04:00
#enrollments = pd.read_csv("DataSets/Enrollments.csv", sep=";")
#enrollments = np.array(enrollments["Enrollments"])
#taiex = pd.read_csv("DataSets/TAIEX.csv", sep=",")
#taiex_treino = np.array(taiex["avg"][2500:3900])
#taiex_teste = np.array(taiex["avg"][3901:4500])
2017-02-01 20:54:37 +04:00
#nasdaq = pd.read_csv("DataSets/NASDAQ_IXIC.csv", sep=",")
#nasdaq_treino = np.array(nasdaq["avg"][0:1600])
#nasdaq_teste = np.array(nasdaq["avg"][1601:2000])
2017-02-01 20:54:37 +04:00
diff = Transformations.Differential(1)
2017-02-15 05:01:44 +04:00
fs = Grid.GridPartitionerTrimf(gauss_treino,10)
#tmp = chen.ConventionalFTS("")
2017-02-16 00:16:13 +04:00
#pfts1 = pfts.ProbabilisticFTS("1")
#pfts1.appendTransformation(diff)
2017-02-16 00:16:13 +04:00
pfts1.train(gauss_treino,fs,1)
pfts2 = pfts.ProbabilisticFTS("n = 2")
2017-02-01 20:54:37 +04:00
#pfts2.appendTransformation(diff)
2017-02-16 00:16:13 +04:00
pfts2.train(gauss_treino,fs,2)
2017-02-01 20:54:37 +04:00
2017-02-15 05:01:44 +04:00
#pfts3 = pfts.ProbabilisticFTS("n = 3")
2017-02-01 20:54:37 +04:00
#pfts3.appendTransformation(diff)
2017-02-15 05:01:44 +04:00
#pfts3.train(gauss_treino,fs,3)
2017-02-01 20:54:37 +04:00
2017-02-15 05:01:44 +04:00
#densities1 = pfts1.forecastAheadDistribution(gauss_teste[:50],2,1.50, parameters=2)
2017-02-01 20:54:37 +04:00
#print(bchmk.getDistributionStatistics(gauss_teste[:50], [pfts1,pfts2,pfts3], 20, 1.50))
2017-02-15 05:01:44 +04:00