ResidualAnalysis bugfix
This commit is contained in:
parent
aa4598f79f
commit
039dca9d5d
@ -69,7 +69,7 @@ def plot_residuals_by_model(targets, models, tam=[8, 8], save=False, file=None):
|
|||||||
else:
|
else:
|
||||||
ax = axes
|
ax = axes
|
||||||
forecasts = mfts.predict(targets)
|
forecasts = mfts.predict(targets)
|
||||||
res = residuals(targets, forecasts, mfts.order+1)
|
res = residuals(targets, forecasts, mfts.order)
|
||||||
mu = np.mean(res)
|
mu = np.mean(res)
|
||||||
sig = np.std(res)
|
sig = np.std(res)
|
||||||
|
|
||||||
|
@ -17,7 +17,11 @@ 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.data import TAIEX, NASDAQ, SP500
|
from pyFTS.common import Transformations
|
||||||
|
|
||||||
|
tdiff = Transformations.Differential(1)
|
||||||
|
|
||||||
|
boxcox = Transformations.BoxCox(0)
|
||||||
|
|
||||||
from pyFTS.data import TAIEX, NASDAQ, SP500
|
from pyFTS.data import TAIEX, NASDAQ, SP500
|
||||||
from pyFTS.common import Util
|
from pyFTS.common import Util
|
||||||
@ -28,10 +32,18 @@ test = TAIEX.get_data()[1800:2000]
|
|||||||
from pyFTS.models import pwfts
|
from pyFTS.models import pwfts
|
||||||
from pyFTS.partitioners import Grid
|
from pyFTS.partitioners import Grid
|
||||||
|
|
||||||
fs = Grid.GridPartitioner(data=train, npart=45)
|
fs = Grid.GridPartitioner(data=train, npart=15, transformation=tdiff)
|
||||||
|
|
||||||
model = pwfts.ProbabilisticWeightedFTS(partitioner=fs, order=1)
|
#model = pwfts.ProbabilisticWeightedFTS(partitioner=fs, order=1)
|
||||||
|
|
||||||
|
model = chen.ConventionalFTS(partitioner=fs)
|
||||||
|
model.append_transformation(tdiff)
|
||||||
model.fit(train)
|
model.fit(train)
|
||||||
|
|
||||||
|
from pyFTS.benchmarks import ResidualAnalysis as ra
|
||||||
|
|
||||||
|
ra.plot_residuals_by_model(test, [model])
|
||||||
|
|
||||||
horizon = 10
|
horizon = 10
|
||||||
'''
|
'''
|
||||||
forecasts = model.predict(test[9:20], type='point')
|
forecasts = model.predict(test[9:20], type='point')
|
||||||
@ -41,7 +53,7 @@ distributions = model.predict(test[9:20], type='distribution')
|
|||||||
forecasts = model.predict(test[9:20], type='point', steps_ahead=horizon)
|
forecasts = model.predict(test[9:20], type='point', steps_ahead=horizon)
|
||||||
intervals = model.predict(test[9:20], type='interval', steps_ahead=horizon)
|
intervals = model.predict(test[9:20], type='interval', steps_ahead=horizon)
|
||||||
'''
|
'''
|
||||||
distributions = model.predict(test[9:20], type='distribution', steps_ahead=horizon)
|
#distributions = model.predict(test[9:20], type='distribution', steps_ahead=horizon)
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
Loading…
Reference in New Issue
Block a user