PEP 256 documentation

This commit is contained in:
Petrônio Cândido 2018-04-14 10:22:02 -03:00
parent 67a9d7e324
commit ecfc9db862
35 changed files with 241 additions and 54 deletions

View File

@ -53,7 +53,6 @@ def rmse_interval(targets, forecasts):
return np.sqrt(np.nanmean((fmean - targets) ** 2)) return np.sqrt(np.nanmean((fmean - targets) ** 2))
def mape(targets, forecasts): def mape(targets, forecasts):
""" """
Mean Average Percentual Error Mean Average Percentual Error
@ -68,7 +67,6 @@ def mape(targets, forecasts):
return np.mean(np.abs(targets - forecasts) / targets) * 100 return np.mean(np.abs(targets - forecasts) / targets) * 100
def smape(targets, forecasts, type=2): def smape(targets, forecasts, type=2):
""" """
Symmetric Mean Average Percentual Error Symmetric Mean Average Percentual Error
@ -89,13 +87,11 @@ def smape(targets, forecasts, type=2):
return sum(np.abs(forecasts - targets)) / sum(forecasts + targets) return sum(np.abs(forecasts - targets)) / sum(forecasts + targets)
def mape_interval(targets, forecasts): def mape_interval(targets, forecasts):
fmean = [np.mean(i) for i in forecasts] fmean = [np.mean(i) for i in forecasts]
return np.mean(abs(fmean - targets) / fmean) * 100 return np.mean(abs(fmean - targets) / fmean) * 100
def UStatistic(targets, forecasts): def UStatistic(targets, forecasts):
""" """
Theil's U Statistic Theil's U Statistic
@ -117,7 +113,6 @@ def UStatistic(targets, forecasts):
return np.sqrt(sum(y) / sum(naive)) return np.sqrt(sum(y) / sum(naive))
def TheilsInequality(targets, forecasts): def TheilsInequality(targets, forecasts):
""" """
Theils Inequality Coefficient Theils Inequality Coefficient
@ -194,7 +189,7 @@ def pinball(tau, target, forecast):
:param tau: quantile value in the range (0,1) :param tau: quantile value in the range (0,1)
:param target: :param target:
:param forecast: :param forecast:
:return: distance of forecast to the tau-quantile of the target :return: float, distance of forecast to the tau-quantile of the target
""" """
if target >= forecast: if target >= forecast:
return (target - forecast) * tau return (target - forecast) * tau
@ -208,7 +203,7 @@ def pinball_mean(tau, targets, forecasts):
:param tau: quantile value in the range (0,1) :param tau: quantile value in the range (0,1)
:param targets: list of target values :param targets: list of target values
:param forecasts: list of prediction intervals :param forecasts: list of prediction intervals
:return: :return: float, the pinball loss mean for tau quantile
""" """
try: try:
if tau <= 0.5: if tau <= 0.5:
@ -220,7 +215,6 @@ def pinball_mean(tau, targets, forecasts):
print(ex) print(ex)
def pmf_to_cdf(density): def pmf_to_cdf(density):
ret = [] ret = []
for row in density.index: for row in density.index:
@ -244,7 +238,12 @@ def heavyside_cdf(bins, targets):
def crps(targets, densities): def crps(targets, densities):
"""Continuous Ranked Probability Score""" '''
Continuous Ranked Probability Score
:param targets: a list with the target values
:param densities: a list with pyFTS.probabil objectsistic.ProbabilityDistribution
:return: float
'''
_crps = float(0.0) _crps = float(0.0)
if isinstance(densities, pd.DataFrame): if isinstance(densities, pd.DataFrame):
l = len(densities.columns) l = len(densities.columns)
@ -269,7 +268,13 @@ def crps(targets, densities):
def get_point_statistics(data, model, **kwargs): def get_point_statistics(data, model, **kwargs):
"""Condensate all measures for point forecasters""" '''
Condensate all measures for point forecasters
:param data: test data
:param model: FTS model with point forecasting capability
:param kwargs:
:return: a list with the RMSE, SMAPE and U Statistic
'''
steps_ahead = kwargs.get('steps_ahead',1) steps_ahead = kwargs.get('steps_ahead',1)
@ -307,7 +312,14 @@ def get_point_statistics(data, model, **kwargs):
def get_interval_statistics(data, model, **kwargs): def get_interval_statistics(data, model, **kwargs):
"""Condensate all measures for point_to_interval forecasters""" '''
Condensate all measures for point interval forecasters
:param data: test data
:param model: FTS model with interval forecasting capability
:param kwargs:
:return: a list with the sharpness, resolution, coverage, .05 pinball mean,
.25 pinball mean, .75 pinball mean and .95 pinball mean.
'''
steps_ahead = kwargs.get('steps_ahead', 1) steps_ahead = kwargs.get('steps_ahead', 1)
@ -341,6 +353,13 @@ def get_interval_statistics(data, model, **kwargs):
def get_distribution_statistics(data, model, **kwargs): def get_distribution_statistics(data, model, **kwargs):
'''
Get CRPS statistic and time for a forecasting model
:param data: test data
:param model: FTS model with probabilistic forecasting capability
:param kwargs:
:return: a list with the CRPS and execution time
'''
steps_ahead = kwargs.get('steps_ahead', 1) steps_ahead = kwargs.get('steps_ahead', 1)
ret = list() ret = list()

View File

@ -31,7 +31,7 @@ def chi_squared(q, h):
def compare_residuals(data, models): def compare_residuals(data, models):
""" """
Compare residual's statistics of several models Compare residual's statistics of several models
:param data: :param data: test data
:param models: :param models:
:return: :return:
""" """

View File

@ -1,5 +1,5 @@
""" """
Benchmark utility functions Facilities for pyFTS Benchmark module
""" """
import matplotlib as plt import matplotlib as plt

View File

@ -51,22 +51,31 @@ def __pop(key, default, kwargs):
def sliding_window_benchmarks(data, windowsize, train=0.8, **kwargs): def sliding_window_benchmarks(data, windowsize, train=0.8, **kwargs):
""" """
Sliding window benchmarks for FTS point forecasters Sliding window benchmarks for FTS point forecasters
:param data: :param data: test data
:param windowsize: size of sliding window :param windowsize: size of sliding window
:param train: percentual of sliding window data used to train the models :param train: percentual of sliding window data used to train the models
:param models: FTS point forecasters :param kwargs: dict, optional arguments
:param partitioners: Universe of Discourse partitioner
:param partitions: the max number of partitions on the Universe of Discourse :keyword
:param max_order: the max order of the models (for high order models) models: FTS point forecasters
:param transformation: data transformation partitioners: Universe of Discourse partitioner
:param indexer: seasonal indexer partitions: the max number of partitions on the Universe of Discourse
:param dump: max_order: the max order of the models (for high order models)
:param benchmark_methods: Non FTS models to benchmark type: the forecasting type, one of these values: point(default), interval or distribution.
:param benchmark_methods_parameters: Non FTS models parameters steps_ahead: The forecasting horizon, i. e., the number of steps ahead to forecast
:param save: save results start: in the multi step forecasting, the index of the data where to start forecasting
:param file: file path to save the results transformation: data transformation
:param sintetic: if true only the average and standard deviation of the results indexer: seasonal indexer
:return: DataFrame with the results progress: If true a progress bar will be displayed during the benchmarks
distributed: boolean, indicate if the forecasting procedure will be distributed in a dispy cluster
nodes: a list with the dispy cluster nodes addresses
benchmark_methods: Non FTS models to benchmark
benchmark_methods_parameters: Non FTS models parameters
save: save results
file: file path to save the results
sintetic: if true only the average and standard deviation of the results
:return: DataFrame with the benchmark results
""" """
distributed = __pop('distributed', False, kwargs) distributed = __pop('distributed', False, kwargs)
save = __pop('save', False, kwargs) save = __pop('save', False, kwargs)
@ -226,6 +235,12 @@ def sliding_window_benchmarks(data, windowsize, train=0.8, **kwargs):
if job.status == dispy.DispyJob.Finished and job is not None: if job.status == dispy.DispyJob.Finished and job is not None:
tmp = job() tmp = job()
jobs2.append(tmp) jobs2.append(tmp)
print(tmp)
else:
print("status",job.status)
print("result",job.result)
print("stdout",job.stdout)
print("stderr",job.exception)
jobs = deepcopy(jobs2) jobs = deepcopy(jobs2)
@ -234,6 +249,8 @@ def sliding_window_benchmarks(data, windowsize, train=0.8, **kwargs):
file = kwargs.get('file', None) file = kwargs.get('file', None)
sintetic = kwargs.get('sintetic', False) sintetic = kwargs.get('sintetic', False)
print(jobs)
return synthesis_method(jobs, experiments, save, file, sintetic) return synthesis_method(jobs, experiments, save, file, sintetic)

View File

@ -1,12 +1,17 @@
import numpy as np
from pyFTS.common import FuzzySet
""" """
This module implements functions for Fuzzy Logical Relationship generation This module implements functions for Fuzzy Logical Relationship generation
""" """
import numpy as np
from pyFTS.common import FuzzySet
class FLR(object): class FLR(object):
"""Fuzzy Logical Relationship""" """
Fuzzy Logical Relationship
Represents a temporal transition of the fuzzy set LHS on time t for the fuzzy set RHS on time t+1.
"""
def __init__(self, LHS, RHS): def __init__(self, LHS, RHS):
""" """
Creates a Fuzzy Logical Relationship Creates a Fuzzy Logical Relationship

View File

@ -1,3 +1,7 @@
"""
Common data transformation used on pre and post processing of the FTS
"""
import numpy as np import numpy as np
import math import math
from pyFTS import * from pyFTS import *
@ -5,7 +9,7 @@ from pyFTS import *
class Transformation(object): class Transformation(object):
""" """
Data transformation used to pre and post processing of the FTS Data transformation used on pre and post processing of the FTS
""" """
def __init__(self, **kwargs): def __init__(self, **kwargs):
@ -13,9 +17,23 @@ class Transformation(object):
self.minimal_length = 1 self.minimal_length = 1
def apply(self, data, param, **kwargs): def apply(self, data, param, **kwargs):
"""
Apply the transformation on input data
:param data: input data
:param param:
:param kwargs:
:return: numpy array with transformed data
"""
pass pass
def inverse(self,data, param, **kwargs): def inverse(self,data, param, **kwargs):
"""
:param data: transformed data
:param param:
:param kwargs:
:return: numpy array with inverse transformed data
"""
pass pass
def __str__(self): def __str__(self):
@ -73,6 +91,11 @@ class Differential(Transformation):
class Scale(Transformation): class Scale(Transformation):
"""
Scale data inside a interval [min, max]
"""
def __init__(self, min=0, max=1): def __init__(self, min=0, max=1):
super(Scale, self).__init__() super(Scale, self).__init__()
self.data_max = None self.data_max = None
@ -130,6 +153,9 @@ class AdaptiveExpectation(Transformation):
class BoxCox(Transformation): class BoxCox(Transformation):
"""
Box-Cox power transformation
"""
def __init__(self, plambda): def __init__(self, plambda):
super(BoxCox, self).__init__() super(BoxCox, self).__init__()
self.plambda = plambda self.plambda = plambda

View File

@ -1,3 +1,7 @@
"""
Common facilities for pyFTS
"""
import time import time
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import dill import dill

View File

@ -2,6 +2,12 @@ import numpy as np
class FLRG(object): class FLRG(object):
"""
Fuzzy Logical Relationship Group
Group a set of FLR's with the same LHS. Represents the temporal patterns for time t+1 (the RHS fuzzy sets)
when the LHS pattern is identified on time t.
"""
def __init__(self, order, **kwargs): def __init__(self, order, **kwargs):
self.LHS = None self.LHS = None

View File

@ -120,7 +120,6 @@ class FTS(object):
return ret return ret
def forecast(self, data, **kwargs): def forecast(self, data, **kwargs):
""" """
Point forecast one step ahead Point forecast one step ahead

View File

@ -1,9 +1,17 @@
"""
Tree data structure
"""
from pyFTS import * from pyFTS import *
from functools import reduce from functools import reduce
import numpy as np import numpy as np
class FLRGTreeNode: class FLRGTreeNode:
"""
Tree node for
"""
def __init__(self, value): def __init__(self, value):
self.isRoot = False self.isRoot = False
self.children = [] self.children = []

View File

@ -4,11 +4,19 @@ import numpy as np
def get_data(): def get_data():
"""
Get a simple univariate time series data.
:return: numpy array
"""
dat = get_dataframe() dat = get_dataframe()
dat = np.array(dat["Passengers"]) dat = np.array(dat["Passengers"])
return dat return dat
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('AirPassengers.csv', dat = common.get_dataframe('AirPassengers.csv',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/AirPassengers.csv', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/AirPassengers.csv',
sep=",") sep=",")

View File

@ -4,6 +4,10 @@ import numpy as np
def get_data(): def get_data():
"""
Get a simple univariate time series data.
:return: numpy array
"""
dat = get_dataframe() dat = get_dataframe()
dat = np.array(dat["Enrollments"]) dat = np.array(dat["Enrollments"])
return dat return dat

View File

@ -18,6 +18,10 @@ import pandas as pd
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('INMET.csv.bz2', dat = common.get_dataframe('INMET.csv.bz2',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/INMET.csv.bz2', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/INMET.csv.bz2',
sep=";", compression='bz2') sep=";", compression='bz2')

View File

@ -4,12 +4,21 @@ import numpy as np
def get_data(field): def get_data(field):
"""
Get a simple univariate time series data.
:param field: the dataset field name to extract
:return: numpy array
"""
dat = get_dataframe() dat = get_dataframe()
dat = np.array(dat[field]) dat = np.array(dat[field])
return dat return dat
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('NASDAQ.csv.bz2', dat = common.get_dataframe('NASDAQ.csv.bz2',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/NASDAQ.csv.bz2', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/NASDAQ.csv.bz2',
sep=";", compression='bz2') sep=";", compression='bz2')

View File

@ -4,12 +4,21 @@ import numpy as np
def get_data(field): def get_data(field):
"""
Get a simple univariate time series data.
:param field: the dataset field name to extract
:return: numpy array
"""
dat = get_dataframe() dat = get_dataframe()
dat = np.array(dat[field]) dat = np.array(dat[field])
return dat return dat
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('SONDA_BSB.csv.bz2', dat = common.get_dataframe('SONDA_BSB.csv.bz2',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/SONDA_BSB.csv.bz2', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/SONDA_BSB.csv.bz2',
sep=";", compression='bz2') sep=";", compression='bz2')

View File

@ -4,6 +4,10 @@ import numpy as np
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('SP500.csv.bz2', dat = common.get_dataframe('SP500.csv.bz2',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/SP500.csv.bz2', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/SP500.csv.bz2',
sep=",", compression='bz2') sep=",", compression='bz2')

View File

@ -4,12 +4,20 @@ import numpy as np
def get_data(): def get_data():
"""
:param field: the dataset field name to extract
:return: numpy array
"""
dat = get_dataframe() dat = get_dataframe()
dat = np.array(dat["avg"]) dat = np.array(dat["avg"])
return dat return dat
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('TAIEX.csv.bz2', dat = common.get_dataframe('TAIEX.csv.bz2',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/TAIEX.csv.bz2', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/TAIEX.csv.bz2',
sep=",", compression='bz2') sep=",", compression='bz2')

View File

@ -0,0 +1,3 @@
"""
Module for pyFTS standard datasets facilities
"""

View File

@ -1,3 +1,7 @@
"""
Facilities to generate synthetic stochastic processes
"""
import numpy as np import numpy as np

View File

@ -1,3 +1,4 @@
import pandas as pd import pandas as pd
import numpy as np import numpy as np
import os import os
@ -7,7 +8,16 @@ from urllib import request
def get_dataframe(filename, url, sep=";", compression='infer'): def get_dataframe(filename, url, sep=";", compression='infer'):
#filename = pkg_resources.resource_filename('pyFTS', path) """
This method check if filename already exists, read the file and return its data.
If the file don't already exists, it will be downloaded and decompressed.
:param filename: dataset local filename
:param url: dataset internet URL
:param sep: CSV field separator
:param compression: type of compression
:return: Pandas dataset
"""
tmp_file = Path(filename) tmp_file = Path(filename)
if tmp_file.is_file(): if tmp_file.is_file():

View File

@ -3,11 +3,19 @@ import pandas as pd
import numpy as np import numpy as np
def get_data(): def get_data():
"""
Get a simple univariate time series data.
:return: numpy array
"""
dat = get_dataframe() dat = get_dataframe()
dat = np.array(dat["SUNACTIVITY"]) dat = np.array(dat["SUNACTIVITY"])
return dat return dat
def get_dataframe(): def get_dataframe():
"""
Get the complete multivariate time series data.
:return: Pandas DataFrame
"""
dat = common.get_dataframe('sunspots.csv', dat = common.get_dataframe('sunspots.csv',
'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/sunspots.csv', 'https://github.com/petroniocandido/pyFTS/raw/8f20f3634aa6a8f58083bdcd1bbf93795e6ed767/pyFTS/data/sunspots.csv',
sep=",") sep=",")

View File

@ -0,0 +1,3 @@
"""
Fuzzy Time Series methods
"""

View File

@ -0,0 +1,3 @@
"""
Meta FTS that aggregates other FTS methods
"""

View File

@ -1,6 +1,13 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
"""
High Order Interval Fuzzy Time Series
SILVA, Petrônio CL; SADAEI, Hossein Javedani; GUIMARÃES, Frederico Gadelha. Interval Forecasting with Fuzzy Time Series.
In: Computational Intelligence (SSCI), 2016 IEEE Symposium Series on. IEEE, 2016. p. 1-8.
"""
import numpy as np import numpy as np
from pyFTS.common import FuzzySet, FLR, fts, tree from pyFTS.common import FuzzySet, FLR, fts, tree
from pyFTS.models import hofts from pyFTS.models import hofts
@ -9,9 +16,6 @@ from pyFTS.models import hofts
class IntervalFTS(hofts.HighOrderFTS): class IntervalFTS(hofts.HighOrderFTS):
""" """
High Order Interval Fuzzy Time Series High Order Interval Fuzzy Time Series
SILVA, Petrônio CL; SADAEI, Hossein Javedani; GUIMARÃES, Frederico Gadelha. Interval Forecasting with Fuzzy Time Series.
In: Computational Intelligence (SSCI), 2016 IEEE Symposium Series on. IEEE, 2016. p. 1-8.
""" """
def __init__(self, name, **kwargs): def __init__(self, name, **kwargs):
super(IntervalFTS, self).__init__(name="IFTS " + name, **kwargs) super(IntervalFTS, self).__init__(name="IFTS " + name, **kwargs)

View File

@ -0,0 +1,3 @@
"""
Multivariate Fuzzy Time Series methods
"""

View File

@ -0,0 +1,3 @@
"""
Fuzzy time series with nonstationary fuzzy sets, for heteroskedastic data
"""

View File

@ -0,0 +1,3 @@
"""
Jupyter notebooks with pyFTS usage examples
"""

View File

@ -1,3 +1,8 @@
"""
C. H. Cheng, R. J. Chang, and C. A. Yeh, Entropy-based and trapezoidal fuzzification-based fuzzy time series approach for forecasting IT project cost,
Technol. Forecast. Social Change, vol. 73, no. 5, pp. 524542, Jun. 2006.
"""
import numpy as np import numpy as np
import math import math
import random as rnd import random as rnd
@ -5,9 +10,6 @@ import functools, operator
from pyFTS.common import FuzzySet, Membership from pyFTS.common import FuzzySet, Membership
from pyFTS.partitioners import partitioner from pyFTS.partitioners import partitioner
# C. H. Cheng, R. J. Chang, and C. A. Yeh, “Entropy-based and trapezoidal fuzzification-based fuzzy time series approach for forecasting IT project cost,”
# Technol. Forecast. Social Change, vol. 73, no. 5, pp. 524542, Jun. 2006.
def splitBelow(data,threshold): def splitBelow(data,threshold):
return [k for k in data if k <= threshold] return [k for k in data if k <= threshold]

View File

@ -1,3 +1,7 @@
"""
S. T. Li, Y. C. Cheng, and S. Y. Lin, A FCM-based deterministic forecasting model for fuzzy time series,
Comput. Math. Appl., vol. 56, no. 12, pp. 30523063, Dec. 2008. DOI: 10.1016/j.camwa.2008.07.033.
"""
import numpy as np import numpy as np
import math import math
import random as rnd import random as rnd
@ -6,11 +10,6 @@ from pyFTS.common import FuzzySet, Membership
from pyFTS.partitioners import partitioner from pyFTS.partitioners import partitioner
# import CMeans
# S. T. Li, Y. C. Cheng, and S. Y. Lin, “A FCM-based deterministic forecasting model for fuzzy time series,”
# Comput. Math. Appl., vol. 56, no. 12, pp. 30523063, Dec. 2008. DOI: 10.1016/j.camwa.2008.07.033.
def fuzzy_distance(x, y): def fuzzy_distance(x, y):
if isinstance(x, list): if isinstance(x, list):
tmp = functools.reduce(operator.add, [(x[k] - y[k]) ** 2 for k in range(0, len(x))]) tmp = functools.reduce(operator.add, [(x[k] - y[k]) ** 2 for k in range(0, len(x))])

View File

@ -1,3 +1,5 @@
"""Even Length Grid Partitioner"""
import numpy as np import numpy as np
import math import math
import random as rnd import random as rnd

View File

@ -1,15 +1,16 @@
"""
K. H. Huarng, Effective lengths of intervals to improve forecasting in fuzzy time series,
Fuzzy Sets Syst., vol. 123, no. 3, pp. 387394, Nov. 2001.
"""
import numpy as np import numpy as np
import math import math
import random as rnd import random as rnd
import functools, operator import functools, operator
from pyFTS.common import FuzzySet, Membership, Transformations from pyFTS.common import FuzzySet, Membership, Transformations
# K. H. Huarng, “Effective lengths of intervals to improve forecasting in fuzzy time series,”
# Fuzzy Sets Syst., vol. 123, no. 3, pp. 387394, Nov. 2001.
from pyFTS.partitioners import partitioner from pyFTS.partitioners import partitioner
class HuarngPartitioner(partitioner.Partitioner): class HuarngPartitioner(partitioner.Partitioner):
"""Huarng Empirical Partitioner""" """Huarng Empirical Partitioner"""
def __init__(self, **kwargs): def __init__(self, **kwargs):

View File

@ -1,3 +1,7 @@
"""
Facility methods for pyFTS partitioners module
"""
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import matplotlib as plt import matplotlib as plt

View File

@ -0,0 +1,3 @@
"""
Probability Distribution objects
"""

View File

@ -1,10 +1,12 @@
from pyFTS.common import Transformations # -*- coding: utf8 -*-
import numpy as np
""" """
Kernel Density Estimation Kernel Density Estimation
""" """
from pyFTS.common import Transformations
import numpy as np
class KernelSmoothing(object): class KernelSmoothing(object):
"""Kernel Density Estimation""" """Kernel Density Estimation"""

View File

@ -20,10 +20,10 @@ from pyFTS.benchmarks import benchmarks as bchmk
from pyFTS.models import pwfts from pyFTS.models import pwfts
#''' #'''
bchmk.sliding_window_benchmarks(dataset, 1000, train=0.8, inc=0.2, methods=[pwfts.ProbabilisticWeightedFTS], bchmk.sliding_window_benchmarks(dataset[:2000], 1000, train=0.8, inc=0.2, methods=[pwfts.ProbabilisticWeightedFTS],
benchmark_models=False, orders=[1], partitions=[10], #np.arange(10,100,2), benchmark_models=False, orders=[1,2,3], partitions=[30,50,70], #np.arange(10,100,2),
progress=False, type='distribution', steps_ahead=[1,4,7,10], progress=False, type='distribution', steps_ahead=[1,4,7,10],
#distributed=False, nodes=['192.168.0.106', '192.168.0.105', '192.168.0.110'], distributed=True, nodes=['192.168.0.102','192.168.0.106','192.168.0.110'],
save=True, file="pwfts_taiex_distribution.csv") save=True, file="pwfts_taiex_distribution.csv")
#''' #'''