From e4838693a61714adeaa42c6a13e41a3c7d729df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Mon, 26 Feb 2018 13:29:11 -0300 Subject: [PATCH] - Deep refactor on project folders --- pyFTS/benchmarks/arima.py | 3 +-- pyFTS/benchmarks/benchmarks.py | 8 +++----- pyFTS/benchmarks/distributed_benchmarks.py | 11 ++++++----- pyFTS/benchmarks/naive.py | 2 +- pyFTS/benchmarks/quantreg.py | 3 +-- pyFTS/{ => common}/flrg.py | 0 pyFTS/{ => common}/fts.py | 0 pyFTS/{ => common}/tree.py | 0 pyFTS/{ => models}/chen.py | 3 +-- pyFTS/{ => models}/cheng.py | 4 ++-- pyFTS/{ => models}/ensemble/__init__.py | 0 pyFTS/{ => models}/ensemble/ensemble.py | 14 ++++---------- pyFTS/{ => models}/ensemble/multiseasonal.py | 15 ++++----------- pyFTS/{ => models}/hofts.py | 4 +--- pyFTS/{ => models}/hwang.py | 3 +-- pyFTS/{ => models}/ifts.py | 4 ++-- pyFTS/{ => models}/ismailefendi.py | 3 +-- pyFTS/{ => models}/nonstationary/__init__.py | 0 pyFTS/{ => models}/nonstationary/common.py | 2 +- pyFTS/{ => models}/nonstationary/cvfts.py | 6 +++--- pyFTS/{ => models}/nonstationary/flrg.py | 4 ++-- pyFTS/{ => models}/nonstationary/honsfts.py | 5 ++--- pyFTS/{ => models}/nonstationary/nsfts.py | 3 +-- .../{ => models}/nonstationary/partitioners.py | 2 +- .../{ => models}/nonstationary/perturbation.py | 0 pyFTS/{ => models}/nonstationary/util.py | 0 pyFTS/{ => models}/pwfts.py | 4 ++-- pyFTS/{ => models}/sadaei.py | 3 +-- pyFTS/{ => models}/seasonal/SeasonalIndexer.py | 3 +-- pyFTS/{ => models}/seasonal/__init__.py | 0 pyFTS/{ => models}/seasonal/cmsfts.py | 5 +++-- pyFTS/{ => models}/seasonal/common.py | 0 pyFTS/{ => models}/seasonal/msfts.py | 4 ++-- pyFTS/{ => models}/seasonal/sfts.py | 3 +-- pyFTS/{ => models}/song.py | 3 +-- pyFTS/{ => models}/yu.py | 4 ++-- pyFTS/tests/cmsfts.py | 4 ++-- pyFTS/tests/distributed.py | 9 ++++----- pyFTS/tests/ensemble.py | 17 +++++------------ pyFTS/tests/general.py | 11 ++--------- pyFTS/tests/nonstationary.py | 3 ++- pyFTS/tests/pwfts.py | 6 ++---- pyFTS/tests/sfts.py | 16 +--------------- setup.py | 11 ++++++----- 44 files changed, 75 insertions(+), 130 deletions(-) rename pyFTS/{ => common}/flrg.py (100%) rename pyFTS/{ => common}/fts.py (100%) rename pyFTS/{ => common}/tree.py (100%) rename pyFTS/{ => models}/chen.py (97%) rename pyFTS/{ => models}/cheng.py (94%) rename pyFTS/{ => models}/ensemble/__init__.py (100%) rename pyFTS/{ => models}/ensemble/ensemble.py (94%) rename pyFTS/{ => models}/ensemble/multiseasonal.py (84%) rename pyFTS/{ => models}/hofts.py (98%) rename pyFTS/{ => models}/hwang.py (94%) rename pyFTS/{ => models}/ifts.py (98%) rename pyFTS/{ => models}/ismailefendi.py (97%) rename pyFTS/{ => models}/nonstationary/__init__.py (100%) rename pyFTS/{ => models}/nonstationary/common.py (99%) rename pyFTS/{ => models}/nonstationary/cvfts.py (97%) rename pyFTS/{ => models}/nonstationary/flrg.py (96%) rename pyFTS/{ => models}/nonstationary/honsfts.py (99%) rename pyFTS/{ => models}/nonstationary/nsfts.py (98%) rename pyFTS/{ => models}/nonstationary/partitioners.py (98%) rename pyFTS/{ => models}/nonstationary/perturbation.py (100%) rename pyFTS/{ => models}/nonstationary/util.py (100%) rename pyFTS/{ => models}/pwfts.py (99%) rename pyFTS/{ => models}/sadaei.py (97%) rename pyFTS/{ => models}/seasonal/SeasonalIndexer.py (98%) rename pyFTS/{ => models}/seasonal/__init__.py (100%) rename pyFTS/{ => models}/seasonal/cmsfts.py (96%) rename pyFTS/{ => models}/seasonal/common.py (100%) rename pyFTS/{ => models}/seasonal/msfts.py (96%) rename pyFTS/{ => models}/seasonal/sfts.py (97%) rename pyFTS/{ => models}/song.py (97%) rename pyFTS/{ => models}/yu.py (97%) diff --git a/pyFTS/benchmarks/arima.py b/pyFTS/benchmarks/arima.py index c8aa3e5..af89d76 100644 --- a/pyFTS/benchmarks/arima.py +++ b/pyFTS/benchmarks/arima.py @@ -5,8 +5,7 @@ import numpy as np import pandas as pd from statsmodels.tsa.arima_model import ARIMA as stats_arima import scipy.stats as st -from pyFTS import fts -from pyFTS.common import SortedCollection +from pyFTS.common import SortedCollection, fts from pyFTS.probabilistic import ProbabilityDistribution diff --git a/pyFTS/benchmarks/benchmarks.py b/pyFTS/benchmarks/benchmarks.py index 285606e..ed0cd11 100644 --- a/pyFTS/benchmarks/benchmarks.py +++ b/pyFTS/benchmarks/benchmarks.py @@ -13,14 +13,14 @@ import matplotlib.cm as cmx import matplotlib.colors as pltcolors import matplotlib.pyplot as plt import numpy as np -import pandas as pd #from mpl_toolkits.mplot3d import Axes3D from pyFTS.probabilistic import ProbabilityDistribution -from pyFTS import song, chen, yu, ismailefendi, sadaei, hofts, pwfts, ifts, cheng, ensemble, hwang +from pyFTS.models import song, chen, yu, ismailefendi, sadaei, hofts, pwfts, ifts, cheng, hwang +from pyFTS.models.ensemble import ensemble from pyFTS.benchmarks import Measures, naive, arima, ResidualAnalysis, quantreg from pyFTS.benchmarks import Util as bUtil -from pyFTS.common import Transformations, Util +from pyFTS.common import Util # from sklearn.cross_validation import KFold from pyFTS.partitioners import Grid from matplotlib import rc @@ -817,7 +817,6 @@ def plot_compared_intervals_ahead(original, models, colors, distributions, time_ def plot_density_rectange(ax, cmap, density, fig, resolution, time_from, time_to): from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection - from matplotlib.colorbar import ColorbarPatch patches = [] colors = [] for x in density.index: @@ -840,7 +839,6 @@ from pyFTS.common import Transformations def plot_probabilitydistribution_density(ax, cmap, probabilitydist, fig, time_from): from matplotlib.patches import Rectangle from matplotlib.collections import PatchCollection - from matplotlib.colorbar import ColorbarPatch patches = [] colors = [] for ct, dt in enumerate(probabilitydist): diff --git a/pyFTS/benchmarks/distributed_benchmarks.py b/pyFTS/benchmarks/distributed_benchmarks.py index b99cdc6..3500186 100644 --- a/pyFTS/benchmarks/distributed_benchmarks.py +++ b/pyFTS/benchmarks/distributed_benchmarks.py @@ -8,13 +8,12 @@ python3 /usr/local/bin/dispynode.py -i [local IP] -d import datetime import time -from copy import deepcopy import dispy import dispy.httpd import numpy as np -from pyFTS.benchmarks import benchmarks, Util as bUtil, naive, quantreg, arima +from pyFTS.benchmarks import benchmarks, Util as bUtil, quantreg, arima from pyFTS.common import Util from pyFTS.partitioners import Grid @@ -32,7 +31,8 @@ def run_point(mfts, partitioner, train_data, test_data, window_key=None, transfo :return: a dictionary with the benchmark results """ import time - from pyFTS import yu,chen,hofts,ifts,pwfts,ismailefendi,sadaei, song, cheng, hwang + from pyFTS import yu, hofts, pwfts,ismailefendi,sadaei, song, cheng, hwang + from pyFTS.models import chen from pyFTS.partitioners import Grid, Entropy, FCM from pyFTS.benchmarks import Measures, naive, arima, quantreg from pyFTS.common import Transformations @@ -424,9 +424,10 @@ def run_ahead(mfts, partitioner, train_data, test_data, steps, resolution, windo """ import time import numpy as np - from pyFTS import hofts, ifts, pwfts, ensemble + from pyFTS import hofts, ifts, pwfts + from pyFTS.models import ensemble from pyFTS.partitioners import Grid, Entropy, FCM - from pyFTS.benchmarks import Measures, arima, quantreg + from pyFTS.benchmarks import Measures, arima from pyFTS.models.seasonal import SeasonalIndexer tmp = [hofts.HighOrderFTS, ifts.IntervalFTS, pwfts.ProbabilisticWeightedFTS, arima.ARIMA, ensemble.AllMethodEnsembleFTS] diff --git a/pyFTS/benchmarks/naive.py b/pyFTS/benchmarks/naive.py index 217436c..bf9e1c1 100644 --- a/pyFTS/benchmarks/naive.py +++ b/pyFTS/benchmarks/naive.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf8 -*- -from pyFTS import fts +from pyFTS.common import fts class Naive(fts.FTS): diff --git a/pyFTS/benchmarks/quantreg.py b/pyFTS/benchmarks/quantreg.py index 24bd4f7..169e745 100644 --- a/pyFTS/benchmarks/quantreg.py +++ b/pyFTS/benchmarks/quantreg.py @@ -5,8 +5,7 @@ import numpy as np import pandas as pd from statsmodels.regression.quantile_regression import QuantReg from statsmodels.tsa.tsatools import lagmat -from pyFTS import fts -from pyFTS.common import SortedCollection +from pyFTS.common import SortedCollection, fts from pyFTS.probabilistic import ProbabilityDistribution class QuantileRegression(fts.FTS): diff --git a/pyFTS/flrg.py b/pyFTS/common/flrg.py similarity index 100% rename from pyFTS/flrg.py rename to pyFTS/common/flrg.py diff --git a/pyFTS/fts.py b/pyFTS/common/fts.py similarity index 100% rename from pyFTS/fts.py rename to pyFTS/common/fts.py diff --git a/pyFTS/tree.py b/pyFTS/common/tree.py similarity index 100% rename from pyFTS/tree.py rename to pyFTS/common/tree.py diff --git a/pyFTS/chen.py b/pyFTS/models/chen.py similarity index 97% rename from pyFTS/chen.py rename to pyFTS/models/chen.py index 6f148be..d8692af 100644 --- a/pyFTS/chen.py +++ b/pyFTS/models/chen.py @@ -5,8 +5,7 @@ S.-M. Chen, “Forecasting enrollments based on fuzzy time series,” Fuzzy Sets """ import numpy as np -from pyFTS.common import FuzzySet, FLR -from pyFTS import fts,flrg +from pyFTS.common import FuzzySet, FLR, fts, flrg class ConventionalFLRG(flrg.FLRG): diff --git a/pyFTS/cheng.py b/pyFTS/models/cheng.py similarity index 94% rename from pyFTS/cheng.py rename to pyFTS/models/cheng.py index 6b70888..45b8fbc 100644 --- a/pyFTS/cheng.py +++ b/pyFTS/models/cheng.py @@ -6,8 +6,8 @@ Expert Syst. Appl., vol. 36, no. 2, pp. 1826–1832, 2009. """ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts, yu +from pyFTS.common import FuzzySet, FLR, fts +from pyFTS.models import yu class TrendWeightedFLRG(yu.WeightedFLRG): diff --git a/pyFTS/ensemble/__init__.py b/pyFTS/models/ensemble/__init__.py similarity index 100% rename from pyFTS/ensemble/__init__.py rename to pyFTS/models/ensemble/__init__.py diff --git a/pyFTS/ensemble/ensemble.py b/pyFTS/models/ensemble/ensemble.py similarity index 94% rename from pyFTS/ensemble/ensemble.py rename to pyFTS/models/ensemble/ensemble.py index c82f397..996fbda 100644 --- a/pyFTS/ensemble/ensemble.py +++ b/pyFTS/models/ensemble/ensemble.py @@ -3,16 +3,10 @@ import numpy as np import pandas as pd -import math -from operator import itemgetter -from pyFTS.common import FLR, FuzzySet, SortedCollection -from pyFTS import fts, chen, cheng, hofts, hwang, ismailefendi, sadaei, song, yu -from pyFTS.benchmarks import arima, quantreg -from pyFTS.common import Transformations +from pyFTS.common import SortedCollection, fts, tree +from pyFTS.models import chen, cheng, hofts, hwang, ismailefendi, sadaei, song, yu import scipy.stats as st -from pyFTS import tree -from pyFTS.seasonal import sfts, msfts -from pyFTS.probabilistic import ProbabilityDistribution, kde + def sampler(data, quantiles): ret = [] @@ -239,7 +233,7 @@ class AllMethodEnsembleFTS(EnsembleFTS): self.original_min = min(data) fo_methods = [song.ConventionalFTS, chen.ConventionalFTS, yu.WeightedFTS, cheng.TrendWeightedFTS, - sadaei.ExponentialyWeightedFTS, ismailefendi.ImprovedWeightedFTS] + sadaei.ExponentialyWeightedFTS, ismailefendi.ImprovedWeightedFTS] ho_methods = [hofts.HighOrderFTS, hwang.HighOrderFTS] diff --git a/pyFTS/ensemble/multiseasonal.py b/pyFTS/models/ensemble/multiseasonal.py similarity index 84% rename from pyFTS/ensemble/multiseasonal.py rename to pyFTS/models/ensemble/multiseasonal.py index 1c34e8f..df84782 100644 --- a/pyFTS/ensemble/multiseasonal.py +++ b/pyFTS/models/ensemble/multiseasonal.py @@ -2,17 +2,10 @@ # -*- coding: utf8 -*- import numpy as np -import pandas as pd -import math -from operator import itemgetter -from pyFTS.common import FLR, FuzzySet, SortedCollection -from pyFTS import fts, chen, cheng, hofts, hwang, ismailefendi, sadaei, song, yu, sfts -from pyFTS.benchmarks import arima, quantreg -from pyFTS.common import Transformations, Util as cUtil -import scipy.stats as st -from pyFTS.ensemble import ensemble -from pyFTS.models import msfts, cmsfts -from pyFTS.probabilistic import ProbabilityDistribution, kde +from pyFTS.common import Util as cUtil +from pyFTS.models.ensemble import ensemble +from pyFTS.models.seasonal import cmsfts +from pyFTS.probabilistic import ProbabilityDistribution from copy import deepcopy from joblib import Parallel, delayed import multiprocessing diff --git a/pyFTS/hofts.py b/pyFTS/models/hofts.py similarity index 98% rename from pyFTS/hofts.py rename to pyFTS/models/hofts.py index 01d937d..a1522dc 100644 --- a/pyFTS/hofts.py +++ b/pyFTS/models/hofts.py @@ -6,9 +6,7 @@ Fuzzy Sets Syst., vol. 81, no. 3, pp. 311–319, 1996. """ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts, flrg, tree - +from pyFTS.common import FuzzySet, FLR, fts, flrg, tree class HighOrderFLRG(flrg.FLRG): """Conventional High Order Fuzzy Logical Relationship Group""" diff --git a/pyFTS/hwang.py b/pyFTS/models/hwang.py similarity index 94% rename from pyFTS/hwang.py rename to pyFTS/models/hwang.py index 814a01a..b0c033e 100644 --- a/pyFTS/hwang.py +++ b/pyFTS/models/hwang.py @@ -6,8 +6,7 @@ Fuzzy Sets Syst., no. 100, pp. 217–228, 1998. """ import numpy as np -from pyFTS.common import FuzzySet,FLR,Transformations -from pyFTS import fts +from pyFTS.common import FuzzySet, FLR, Transformations, fts class HighOrderFTS(fts.FTS): diff --git a/pyFTS/ifts.py b/pyFTS/models/ifts.py similarity index 98% rename from pyFTS/ifts.py rename to pyFTS/models/ifts.py index 5fcefb1..a77ca50 100644 --- a/pyFTS/ifts.py +++ b/pyFTS/models/ifts.py @@ -2,8 +2,8 @@ # -*- coding: utf8 -*- import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import hofts, fts, tree +from pyFTS.common import FuzzySet, FLR, fts, tree +from pyFTS.models import hofts class IntervalFTS(hofts.HighOrderFTS): diff --git a/pyFTS/ismailefendi.py b/pyFTS/models/ismailefendi.py similarity index 97% rename from pyFTS/ismailefendi.py rename to pyFTS/models/ismailefendi.py index 6b48573..33408a8 100644 --- a/pyFTS/ismailefendi.py +++ b/pyFTS/models/ismailefendi.py @@ -6,8 +6,7 @@ US Dollar to Ringgit Malaysia,” Int. J. Comput. Intell. Appl., vol. 12, no. 1, """ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts, flrg +from pyFTS.common import FuzzySet, FLR, fts, flrg class ImprovedWeightedFLRG(flrg.FLRG): diff --git a/pyFTS/nonstationary/__init__.py b/pyFTS/models/nonstationary/__init__.py similarity index 100% rename from pyFTS/nonstationary/__init__.py rename to pyFTS/models/nonstationary/__init__.py diff --git a/pyFTS/nonstationary/common.py b/pyFTS/models/nonstationary/common.py similarity index 99% rename from pyFTS/nonstationary/common.py rename to pyFTS/models/nonstationary/common.py index 5955a0e..a698df5 100644 --- a/pyFTS/nonstationary/common.py +++ b/pyFTS/models/nonstationary/common.py @@ -9,7 +9,7 @@ import numpy as np from pyFTS import * from pyFTS.common import FuzzySet as FS, Membership, FLR from pyFTS.partitioners import partitioner -from pyFTS.nonstationary import perturbation +from pyFTS.models.nonstationary import perturbation class FuzzySet(FS.FuzzySet): diff --git a/pyFTS/nonstationary/cvfts.py b/pyFTS/models/nonstationary/cvfts.py similarity index 97% rename from pyFTS/nonstationary/cvfts.py rename to pyFTS/models/nonstationary/cvfts.py index 4f8ac94..46a17c4 100644 --- a/pyFTS/nonstationary/cvfts.py +++ b/pyFTS/models/nonstationary/cvfts.py @@ -1,7 +1,7 @@ import numpy as np -from pyFTS import fts, flrg, chen -from pyFTS.nonstationary import common, perturbation, nsfts -from pyFTS.common import Transformations, FuzzySet, FLR +from pyFTS.models import chen +from pyFTS.models.nonstationary import common,nsfts +from pyFTS.common import FLR class ConditionalVarianceFTS(chen.ConventionalFTS): diff --git a/pyFTS/nonstationary/flrg.py b/pyFTS/models/nonstationary/flrg.py similarity index 96% rename from pyFTS/nonstationary/flrg.py rename to pyFTS/models/nonstationary/flrg.py index f412fdf..3c4d2a2 100644 --- a/pyFTS/nonstationary/flrg.py +++ b/pyFTS/models/nonstationary/flrg.py @@ -1,6 +1,6 @@ -from pyFTS import flrg -from pyFTS.nonstationary import common +from pyFTS.common import flrg +from pyFTS.models.nonstationary import common class NonStationaryFLRG(flrg.FLRG): diff --git a/pyFTS/nonstationary/honsfts.py b/pyFTS/models/nonstationary/honsfts.py similarity index 99% rename from pyFTS/nonstationary/honsfts.py rename to pyFTS/models/nonstationary/honsfts.py index e0e3dbe..ea2a726 100644 --- a/pyFTS/nonstationary/honsfts.py +++ b/pyFTS/models/nonstationary/honsfts.py @@ -1,8 +1,7 @@ import numpy as np -from pyFTS.common import FuzzySet, FLR -from pyFTS import fts, hofts +from pyFTS.common import FuzzySet, FLR, fts, tree +from pyFTS.models import hofts from pyFTS.nonstationary import common, flrg -from pyFTS import tree class HighOrderNonStationaryFLRG(flrg.NonStationaryFLRG): diff --git a/pyFTS/nonstationary/nsfts.py b/pyFTS/models/nonstationary/nsfts.py similarity index 98% rename from pyFTS/nonstationary/nsfts.py rename to pyFTS/models/nonstationary/nsfts.py index f59c32d..aab1064 100644 --- a/pyFTS/nonstationary/nsfts.py +++ b/pyFTS/models/nonstationary/nsfts.py @@ -1,6 +1,5 @@ import numpy as np -from pyFTS.common import FuzzySet, FLR -from pyFTS import fts, chen +from pyFTS.common import FLR, fts from pyFTS.nonstationary import common, flrg diff --git a/pyFTS/nonstationary/partitioners.py b/pyFTS/models/nonstationary/partitioners.py similarity index 98% rename from pyFTS/nonstationary/partitioners.py rename to pyFTS/models/nonstationary/partitioners.py index b8a32a2..99dc172 100644 --- a/pyFTS/nonstationary/partitioners.py +++ b/pyFTS/models/nonstationary/partitioners.py @@ -1,6 +1,6 @@ import numpy as np from pyFTS.partitioners import partitioner -from pyFTS.nonstationary import common, perturbation +from pyFTS.models.nonstationary import common, perturbation class PolynomialNonStationaryPartitioner(partitioner.Partitioner): diff --git a/pyFTS/nonstationary/perturbation.py b/pyFTS/models/nonstationary/perturbation.py similarity index 100% rename from pyFTS/nonstationary/perturbation.py rename to pyFTS/models/nonstationary/perturbation.py diff --git a/pyFTS/nonstationary/util.py b/pyFTS/models/nonstationary/util.py similarity index 100% rename from pyFTS/nonstationary/util.py rename to pyFTS/models/nonstationary/util.py diff --git a/pyFTS/pwfts.py b/pyFTS/models/pwfts.py similarity index 99% rename from pyFTS/pwfts.py rename to pyFTS/models/pwfts.py index 4f22288..06dd046 100644 --- a/pyFTS/pwfts.py +++ b/pyFTS/models/pwfts.py @@ -5,8 +5,8 @@ import numpy as np import pandas as pd import math from operator import itemgetter -from pyFTS.common import FLR, FuzzySet, SortedCollection -from pyFTS import hofts, ifts, tree +from pyFTS.common import FLR, FuzzySet, tree +from pyFTS.models import hofts, ifts from pyFTS.probabilistic import ProbabilityDistribution diff --git a/pyFTS/sadaei.py b/pyFTS/models/sadaei.py similarity index 97% rename from pyFTS/sadaei.py rename to pyFTS/models/sadaei.py index 85b510c..e0fc19c 100644 --- a/pyFTS/sadaei.py +++ b/pyFTS/models/sadaei.py @@ -6,8 +6,7 @@ refined exponentially weighted fuzzy time series and an improved harmony search, """ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts, flrg +from pyFTS.common import FuzzySet,FLR,fts, flrg class ExponentialyWeightedFLRG(flrg.FLRG): diff --git a/pyFTS/seasonal/SeasonalIndexer.py b/pyFTS/models/seasonal/SeasonalIndexer.py similarity index 98% rename from pyFTS/seasonal/SeasonalIndexer.py rename to pyFTS/models/seasonal/SeasonalIndexer.py index 7b20f4b..a498ba5 100644 --- a/pyFTS/seasonal/SeasonalIndexer.py +++ b/pyFTS/models/seasonal/SeasonalIndexer.py @@ -1,7 +1,6 @@ import numpy as np import pandas as pd -from enum import Enum -from pyFTS.seasonal import common +from pyFTS.models.seasonal import common class SeasonalIndexer(object): diff --git a/pyFTS/seasonal/__init__.py b/pyFTS/models/seasonal/__init__.py similarity index 100% rename from pyFTS/seasonal/__init__.py rename to pyFTS/models/seasonal/__init__.py diff --git a/pyFTS/seasonal/cmsfts.py b/pyFTS/models/seasonal/cmsfts.py similarity index 96% rename from pyFTS/seasonal/cmsfts.py rename to pyFTS/models/seasonal/cmsfts.py index f6914c8..9789079 100644 --- a/pyFTS/seasonal/cmsfts.py +++ b/pyFTS/models/seasonal/cmsfts.py @@ -1,6 +1,7 @@ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts, sfts, chen +from pyFTS.common import FuzzySet, FLR +from pyFTS.models.seasonal import sfts +from pyFTS.models import chen class ContextualSeasonalFLRG(object): diff --git a/pyFTS/seasonal/common.py b/pyFTS/models/seasonal/common.py similarity index 100% rename from pyFTS/seasonal/common.py rename to pyFTS/models/seasonal/common.py diff --git a/pyFTS/seasonal/msfts.py b/pyFTS/models/seasonal/msfts.py similarity index 96% rename from pyFTS/seasonal/msfts.py rename to pyFTS/models/seasonal/msfts.py index 8e52809..a263bb2 100644 --- a/pyFTS/seasonal/msfts.py +++ b/pyFTS/models/seasonal/msfts.py @@ -1,6 +1,6 @@ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS.seasonal import sfts +from pyFTS.common import FLR +from pyFTS.models.seasonal import sfts class MultiSeasonalFTS(sfts.SeasonalFTS): diff --git a/pyFTS/seasonal/sfts.py b/pyFTS/models/seasonal/sfts.py similarity index 97% rename from pyFTS/seasonal/sfts.py rename to pyFTS/models/seasonal/sfts.py index be813c6..75053c3 100644 --- a/pyFTS/seasonal/sfts.py +++ b/pyFTS/models/seasonal/sfts.py @@ -7,8 +7,7 @@ S.-M. Chen, “Forecasting enrollments based on fuzzy time series,” Fuzzy Sets """ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts +from pyFTS.common import FuzzySet, FLR, fts class SeasonalFLRG(FLR.FLR): diff --git a/pyFTS/song.py b/pyFTS/models/song.py similarity index 97% rename from pyFTS/song.py rename to pyFTS/models/song.py index 16bcbc1..b45fbc6 100644 --- a/pyFTS/song.py +++ b/pyFTS/models/song.py @@ -5,8 +5,7 @@ Q. Song and B. S. Chissom, “Fuzzy time series and its models,” Fuzzy Sets Sy """ import numpy as np -from pyFTS.common import FuzzySet, FLR -from pyFTS import fts +from pyFTS.common import FuzzySet, FLR, fts class ConventionalFTS(fts.FTS): diff --git a/pyFTS/yu.py b/pyFTS/models/yu.py similarity index 97% rename from pyFTS/yu.py rename to pyFTS/models/yu.py index 797ffe2..6b5286a 100644 --- a/pyFTS/yu.py +++ b/pyFTS/models/yu.py @@ -6,8 +6,8 @@ Phys. A Stat. Mech. its Appl., vol. 349, no. 3, pp. 609–624, 2005. """ import numpy as np -from pyFTS.common import FuzzySet,FLR -from pyFTS import fts, flrg, chen +from pyFTS.common import FuzzySet, FLR, fts, flrg +from pyFTS.models import chen class WeightedFLRG(flrg.FLRG): diff --git a/pyFTS/tests/cmsfts.py b/pyFTS/tests/cmsfts.py index 11b16e2..14eab97 100644 --- a/pyFTS/tests/cmsfts.py +++ b/pyFTS/tests/cmsfts.py @@ -12,8 +12,8 @@ import datetime import pandas as pd from pyFTS.partitioners import Grid, CMeans, FCM, Entropy -from pyFTS.common import FLR,FuzzySet,Membership,Transformations,Util -from pyFTS import fts,sfts +from pyFTS.common import FLR, FuzzySet, Membership, Transformations, Util, fts +from pyFTS import sfts from pyFTS.models import msfts from pyFTS.benchmarks import benchmarks as bchmk from pyFTS.benchmarks import Measures diff --git a/pyFTS/tests/distributed.py b/pyFTS/tests/distributed.py index 2cee2cf..8184340 100644 --- a/pyFTS/tests/distributed.py +++ b/pyFTS/tests/distributed.py @@ -1,13 +1,14 @@ from pyFTS.partitioners import Grid -from pyFTS import fts, flrg, song, chen, yu, sadaei, ismailefendi, cheng, hofts +from pyFTS.models import chen from pyFTS.benchmarks import Measures -from pyFTS.common import Util as cUtil +from pyFTS.common import Util as cUtil, fts import pandas as pd import numpy as np import os from pyFTS.common import Transformations from copy import deepcopy -from pyFTS.nonstationary import common, flrg, util, perturbation, nsfts, honsfts, partitioners +from pyFTS.nonstationary import flrg, util, honsfts, partitioners +from pyFTS.models.nonstationary import nsfts bc = Transformations.BoxCox(0) @@ -19,10 +20,8 @@ os.chdir("/home/petronio/Dropbox/Doutorado/Codigos/") def evaluate_individual_model(model, partitioner, train, test, window_size, time_displacement): import numpy as np - from pyFTS.common import FLR, FuzzySet from pyFTS.partitioners import Grid from pyFTS.benchmarks import Measures - from pyFTS.nonstationary import common, flrg, util, perturbation, nsfts, honsfts, partitioners try: model.train(train, sets=partitioner.sets, order=model.order, parameters=window_size) diff --git a/pyFTS/tests/ensemble.py b/pyFTS/tests/ensemble.py index 5107d5f..f332b4a 100644 --- a/pyFTS/tests/ensemble.py +++ b/pyFTS/tests/ensemble.py @@ -3,20 +3,13 @@ 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, Entropy, FCM, Huarng -from pyFTS.common import FLR,FuzzySet,Membership,Transformations -from pyFTS import fts,hofts,ifts,pwfts,tree, chen, song, yu, cheng, ismailefendi, sadaei, hwang -from pyFTS.benchmarks import naive, arima -from numpy import random -from pyFTS.benchmarks import benchmarks as bchmk -from pyFTS.benchmarks import arima, quantreg, Measures -from pyFTS.ensemble import ensemble +from pyFTS.partitioners import Grid +from pyFTS.common import Transformations +from pyFTS import hofts, song, yu, cheng, ismailefendi, sadaei, hwang +from pyFTS.models import chen +from pyFTS.models.ensemble import ensemble os.chdir("/home/petronio/dados/Dropbox/Doutorado/Codigos/") diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index 46450e8..e323adc 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -3,20 +3,13 @@ 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, Entropy, FCM, Huarng -from pyFTS.common import FLR,FuzzySet,Membership,Transformations, Util as cUtil -from pyFTS import fts,hofts,ifts,pwfts,tree, chen +from pyFTS.common import Transformations + #from pyFTS.benchmarks import benchmarks as bchmk -from pyFTS.benchmarks import naive, arima -from pyFTS.benchmarks import Measures -from numpy import random -from pyFTS.seasonal import SeasonalIndexer os.chdir("/home/petronio/dados/Dropbox/Doutorado/Codigos/") diff --git a/pyFTS/tests/nonstationary.py b/pyFTS/tests/nonstationary.py index d662de2..e1651ee 100644 --- a/pyFTS/tests/nonstationary.py +++ b/pyFTS/tests/nonstationary.py @@ -1,7 +1,8 @@ import os import numpy as np from pyFTS.common import Membership, Transformations -from pyFTS.nonstationary import common,perturbation, partitioners, util,nsfts, honsfts, cvfts +from pyFTS.nonstationary import common,perturbation, partitioners, util, honsfts, cvfts +from pyFTS.models.nonstationary import nsfts from pyFTS.partitioners import Grid import matplotlib.pyplot as plt from pyFTS.common import Util as cUtil diff --git a/pyFTS/tests/pwfts.py b/pyFTS/tests/pwfts.py index 3e3f47c..6fc2a9a 100644 --- a/pyFTS/tests/pwfts.py +++ b/pyFTS/tests/pwfts.py @@ -9,11 +9,9 @@ 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,pwfts,tree, chen +from pyFTS.common import FLR, FuzzySet, Membership, Transformations, fts +from pyFTS.models import chen from pyFTS.benchmarks import benchmarks as bchmk -from pyFTS.benchmarks import Measures from numpy import random #gauss_treino = random.normal(0,1.0,1600) diff --git a/pyFTS/tests/sfts.py b/pyFTS/tests/sfts.py index 92d7d63..2c74f9a 100644 --- a/pyFTS/tests/sfts.py +++ b/pyFTS/tests/sfts.py @@ -3,20 +3,10 @@ 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 datetime import pandas as pd -from pyFTS.partitioners import Grid, CMeans, FCM, Entropy -from pyFTS.common import FLR,FuzzySet,Membership,Transformations,Util -from pyFTS import fts -from pyFTS.seasonal import sfts, msfts +from pyFTS.common import Util from pyFTS.benchmarks import benchmarks as bchmk -from pyFTS.benchmarks import Measures os.chdir("/home/petronio/dados/Dropbox/Doutorado/Codigos/") @@ -38,10 +28,6 @@ sonda_teste = sonda[1051201:] # tam=[15,8], plotforecasts=False,elev=45, azim=40, # save=False,file="pictures/sonda_sfts_error_surface", intervals=False) -from pyFTS.models.seasonal import SeasonalIndexer -from pyFTS.models import msfts -from pyFTS.common import FLR - partitions = ['grid','entropy'] indexers = ['m15','Mh','Mhm15'] diff --git a/setup.py b/setup.py index 5b67c7e..fded869 100644 --- a/setup.py +++ b/setup.py @@ -2,11 +2,12 @@ from distutils.core import setup setup( name='pyFTS', - packages=['pyFTS', 'pyFTS.benchmarks', 'pyFTS.common', 'pyFTS.data', 'pyFTS.ensemble', - 'pyFTS.models', 'pyFTS.seasonal', 'pyFTS.partitioners', 'pyFTS.probabilistic', - 'pyFTS.tests', 'pyFTS.nonstationary'], - package_data={'benchmarks': ['*'], 'common': ['*'], 'data': ['*'], 'ensemble': ['*'], 'models': ['*'], - 'seasonal': ['*'], 'partitioners': ['*'], 'probabilistic': ['*'], 'tests': ['*']}, + packages=['pyFTS', 'pyFTS.benchmarks', 'pyFTS.common', 'pyFTS.data', 'pyFTS.models.ensemble', + 'pyFTS.models', 'pyFTS.models.seasonal', 'pyFTS.partitioners', 'pyFTS.probabilistic', + 'pyFTS.tests', 'pyFTS.models.nonstationary'], + package_data={'benchmarks': ['*'], 'common': ['*'], 'data': ['*'], + 'models': ['*'], 'seasonal': ['*'], 'ensemble': ['*'], + 'partitioners': ['*'], 'probabilistic': ['*'], 'tests': ['*']}, version='1.1.1', description='Fuzzy Time Series for Python', author='Petronio Candido L. e Silva',