Bugfixes
This commit is contained in:
parent
1cc022c7d6
commit
3f435222ac
@ -91,3 +91,11 @@ class SeasonalFTS(fts.FTS):
|
|||||||
ret.append(np.percentile(mp, 50))
|
ret.append(np.percentile(mp, 50))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
"""String representation of the model"""
|
||||||
|
|
||||||
|
tmp = self.name + ":\n"
|
||||||
|
for r in self.flrgs:
|
||||||
|
tmp = tmp + str(self.flrgs[r]) + "\n"
|
||||||
|
return tmp
|
||||||
|
@ -42,7 +42,7 @@ def bestSplit(data, npart):
|
|||||||
if len(data) < 2:
|
if len(data) < 2:
|
||||||
return None
|
return None
|
||||||
count = 1
|
count = 1
|
||||||
ndata = list(set(data))
|
ndata = list(set(np.array(data).flatten()))
|
||||||
ndata.sort()
|
ndata.sort()
|
||||||
l = len(ndata)
|
l = len(ndata)
|
||||||
threshold = 0
|
threshold = 0
|
||||||
|
@ -54,7 +54,7 @@ class Partitioner(object):
|
|||||||
|
|
||||||
self.min = float(_min * 1.1 if _min < 0 else _min * 0.9)
|
self.min = float(_min * 1.1 if _min < 0 else _min * 0.9)
|
||||||
|
|
||||||
_max = max(ndata)
|
_max = np.nanmax(ndata)
|
||||||
self.max = float(_max * 1.1 if _max > 0 else _max * 0.9)
|
self.max = float(_max * 1.1 if _max > 0 else _max * 0.9)
|
||||||
|
|
||||||
self.sets = self.build(ndata)
|
self.sets = self.build(ndata)
|
||||||
|
@ -9,13 +9,30 @@ 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, Util as pUtil
|
from pyFTS.partitioners import Grid, Entropy, Util as pUtil
|
||||||
from pyFTS.benchmarks import benchmarks as bchmk
|
from pyFTS.benchmarks import benchmarks as bchmk
|
||||||
from pyFTS.models import chen, yu, cheng, ismailefendi, hofts, pwfts
|
from pyFTS.models import chen, yu, cheng, ismailefendi, hofts, pwfts
|
||||||
from pyFTS.common import Transformations
|
from pyFTS.common import Transformations
|
||||||
|
|
||||||
tdiff = Transformations.Differential(1)
|
tdiff = Transformations.Differential(1)
|
||||||
|
|
||||||
|
data = pd.read_csv('/home/petronio/Downloads/priceHong').values
|
||||||
|
|
||||||
|
split = 24 * 800
|
||||||
|
train = data[:split].flatten()
|
||||||
|
test = data[split:].flatten()
|
||||||
|
|
||||||
|
print(train)
|
||||||
|
|
||||||
|
fs_grid = Grid.GridPartitioner(data=train,npart=25)
|
||||||
|
#fs_entr.plot(ax[1])
|
||||||
|
|
||||||
|
for method in [hofts.HighOrderFTS, pwfts.ProbabilisticWeightedFTS]:
|
||||||
|
for order in [2,3]:
|
||||||
|
model = method(partitioner=fs_grid, order=order)
|
||||||
|
model.fit(train)
|
||||||
|
|
||||||
|
'''
|
||||||
from pyFTS.data import TAIEX, SP500, NASDAQ
|
from pyFTS.data import TAIEX, SP500, NASDAQ
|
||||||
|
|
||||||
dataset = TAIEX.get_data()
|
dataset = TAIEX.get_data()
|
||||||
@ -30,7 +47,7 @@ model.fit(dataset[:800])
|
|||||||
print(model)
|
print(model)
|
||||||
|
|
||||||
ret = model.predict([5000.00, 5200.00, 5400.00], explain=True)
|
ret = model.predict([5000.00, 5200.00, 5400.00], explain=True)
|
||||||
|
'''
|
||||||
'''
|
'''
|
||||||
#dataset = SP500.get_data()[11500:16000]
|
#dataset = SP500.get_data()[11500:16000]
|
||||||
#dataset = NASDAQ.get_data()
|
#dataset = NASDAQ.get_data()
|
||||||
|
Loading…
Reference in New Issue
Block a user