15 lines
674 B
Python
15 lines
674 B
Python
from pyFTS.models import pwfts
|
|
from pyFTS.partitioners import Grid, Entropy, Util as pUtil
|
|
from pyFTS.data import sunspots as DataFrame
|
|
from pyFTS.common import Util, Transformations, fts, tree
|
|
|
|
def pwfts(dataset, trainLength, npart=50):
|
|
fs = Grid.GridPartitioner(data=dataset, npart=50)
|
|
model = pwfts.ProbabilisticWeightedFTS(partitioner=fs)
|
|
model.fit(dataset[:trainLength])
|
|
print(model)
|
|
forecasts = model.predict(dataset[trainLength:trainLength + 200], type='point',
|
|
steps_ahead=int(dataset.size * 0.2)) # , steps_ahead=int(dataset.size*0.2)
|
|
# forecasts = model.forecast_ahead(dataset[:], trainLength)
|
|
|