diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index d0bc3ab..90142b8 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/pyFTS.common.doctree b/docs/build/doctrees/pyFTS.common.doctree index f86650d..2072e8a 100644 Binary files a/docs/build/doctrees/pyFTS.common.doctree and b/docs/build/doctrees/pyFTS.common.doctree differ diff --git a/docs/build/doctrees/pyFTS.hyperparam.doctree b/docs/build/doctrees/pyFTS.hyperparam.doctree index 32e69c3..2878a1b 100644 Binary files a/docs/build/doctrees/pyFTS.hyperparam.doctree and b/docs/build/doctrees/pyFTS.hyperparam.doctree differ diff --git a/docs/build/doctrees/pyFTS.models.doctree b/docs/build/doctrees/pyFTS.models.doctree index 33f073c..c59f07d 100644 Binary files a/docs/build/doctrees/pyFTS.models.doctree and b/docs/build/doctrees/pyFTS.models.doctree differ diff --git a/docs/build/doctrees/pyFTS.models.multivariate.doctree b/docs/build/doctrees/pyFTS.models.multivariate.doctree index 1c0ff2e..79cf397 100644 Binary files a/docs/build/doctrees/pyFTS.models.multivariate.doctree and b/docs/build/doctrees/pyFTS.models.multivariate.doctree differ diff --git a/docs/build/doctrees/pyFTS.partitioners.doctree b/docs/build/doctrees/pyFTS.partitioners.doctree index dff25d7..76600e9 100644 Binary files a/docs/build/doctrees/pyFTS.partitioners.doctree and b/docs/build/doctrees/pyFTS.partitioners.doctree differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index b4e170f..575ea7e 100644 --- a/docs/build/html/.buildinfo +++ b/docs/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: b1d45c9dca0d9aa3496dee4999fef095 +config: 093af40ae69a65311c97d33e0ef16317 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/_modules/index.html b/docs/build/html/_modules/index.html index 8973f86..bf14f90 100644 --- a/docs/build/html/_modules/index.html +++ b/docs/build/html/_modules/index.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - Overview: module code — pyFTS 1.2.3 documentation + Overview: module code — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -542,7 +542,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/ResidualAnalysis.html b/docs/build/html/_modules/pyFTS/benchmarks/ResidualAnalysis.html index 80763b5..010fcba 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/ResidualAnalysis.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/ResidualAnalysis.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.ResidualAnalysis — pyFTS 1.2.3 documentation + pyFTS.benchmarks.ResidualAnalysis — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -242,7 +242,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/Util.html b/docs/build/html/_modules/pyFTS/benchmarks/Util.html index 336abf5..2b3d913 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/Util.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/Util.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.Util — pyFTS 1.2.3 documentation + pyFTS.benchmarks.Util — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -1346,7 +1346,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/arima.html b/docs/build/html/_modules/pyFTS/benchmarks/arima.html index d7b4499..7b48a0a 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/arima.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/arima.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.arima — pyFTS 1.2.3 documentation + pyFTS.benchmarks.arima — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -297,7 +297,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/benchmarks.html b/docs/build/html/_modules/pyFTS/benchmarks/benchmarks.html index 778c367..12e4d83 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/benchmarks.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/benchmarks.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.benchmarks — pyFTS 1.2.3 documentation + pyFTS.benchmarks.benchmarks — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -1305,7 +1305,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/knn.html b/docs/build/html/_modules/pyFTS/benchmarks/knn.html index 8d9224a..538e793 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/knn.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/knn.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.knn — pyFTS 1.2.3 documentation + pyFTS.benchmarks.knn — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -156,7 +156,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/naive.html b/docs/build/html/_modules/pyFTS/benchmarks/naive.html index 612abd5..52eb0c1 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/naive.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/naive.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.naive — pyFTS 1.2.3 documentation + pyFTS.benchmarks.naive — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -106,7 +106,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/benchmarks/quantreg.html b/docs/build/html/_modules/pyFTS/benchmarks/quantreg.html index 414ddce..ff3fdc1 100644 --- a/docs/build/html/_modules/pyFTS/benchmarks/quantreg.html +++ b/docs/build/html/_modules/pyFTS/benchmarks/quantreg.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.benchmarks.quantreg — pyFTS 1.2.3 documentation + pyFTS.benchmarks.quantreg — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -241,7 +241,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/Composite.html b/docs/build/html/_modules/pyFTS/common/Composite.html index 9d7c173..e8a9a3c 100644 --- a/docs/build/html/_modules/pyFTS/common/Composite.html +++ b/docs/build/html/_modules/pyFTS/common/Composite.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.Composite — pyFTS 1.2.3 documentation + pyFTS.common.Composite — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -152,7 +152,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/FLR.html b/docs/build/html/_modules/pyFTS/common/FLR.html index 5031ac4..dfa3cb8 100644 --- a/docs/build/html/_modules/pyFTS/common/FLR.html +++ b/docs/build/html/_modules/pyFTS/common/FLR.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.FLR — pyFTS 1.2.3 documentation + pyFTS.common.FLR — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -206,7 +206,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/FuzzySet.html b/docs/build/html/_modules/pyFTS/common/FuzzySet.html index af36e39..ef4156d 100644 --- a/docs/build/html/_modules/pyFTS/common/FuzzySet.html +++ b/docs/build/html/_modules/pyFTS/common/FuzzySet.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.FuzzySet — pyFTS 1.2.3 documentation + pyFTS.common.FuzzySet — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -180,7 +180,6 @@ first = midpoint + 1 -
    [docs]def fuzzyfy(data, partitioner, **kwargs): """ A general method for fuzzyfication. @@ -191,7 +190,8 @@ :keyword alpha_cut: the minimal membership value to be considered on fuzzyfication (only for mode='sets') :keyword method: the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership) - :keyword mode: the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership values for all fuzzy sets) + :keyword mode: the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership + values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) ) :returns a list with the fuzzyfied values, depending on the mode """ alpha_cut = kwargs.get('alpha_cut', 0.) @@ -200,11 +200,26 @@ if isinstance(data, (list, np.ndarray)): if mode == 'vector': return fuzzyfy_instances(data, partitioner.sets, partitioner.ordered_sets) + elif mode == 'both': + mvs = fuzzyfy_instances(data, partitioner.sets, partitioner.ordered_sets) + fs = [] + for mv in mvs: + fsets = [(partitioner.ordered_sets[ix], mv[ix]) + for ix in np.arange(len(mv)) + if mv[ix] >= alpha_cut] + fs.append(fsets) + return fs else: return fuzzyfy_series(data, partitioner.sets, method, alpha_cut, partitioner.ordered_sets) else: if mode == 'vector': return fuzzyfy_instance(data, partitioner.sets, partitioner.ordered_sets) + elif mode == 'both': + mv = fuzzyfy_instance(data, partitioner.sets, partitioner.ordered_sets) + fsets = [(partitioner.ordered_sets[ix], mv[ix]) + for ix in np.arange(len(mv)) + if mv[ix] >= alpha_cut] + return fsets else: return get_fuzzysets(data, partitioner.sets, partitioner.ordered_sets, alpha_cut)
    @@ -374,7 +389,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/Membership.html b/docs/build/html/_modules/pyFTS/common/Membership.html index df02d06..1389c32 100644 --- a/docs/build/html/_modules/pyFTS/common/Membership.html +++ b/docs/build/html/_modules/pyFTS/common/Membership.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.Membership — pyFTS 1.2.3 documentation + pyFTS.common.Membership — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -178,7 +178,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/SortedCollection.html b/docs/build/html/_modules/pyFTS/common/SortedCollection.html index b0ca7cc..fb2de73 100644 --- a/docs/build/html/_modules/pyFTS/common/SortedCollection.html +++ b/docs/build/html/_modules/pyFTS/common/SortedCollection.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.SortedCollection — pyFTS 1.2.3 documentation + pyFTS.common.SortedCollection — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -315,7 +315,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/Transformations.html b/docs/build/html/_modules/pyFTS/common/Transformations.html index d280992..7852c26 100644 --- a/docs/build/html/_modules/pyFTS/common/Transformations.html +++ b/docs/build/html/_modules/pyFTS/common/Transformations.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.Transformations — pyFTS 1.2.3 documentation + pyFTS.common.Transformations — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -323,7 +323,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/Util.html b/docs/build/html/_modules/pyFTS/common/Util.html index dae40e7..4966c3e 100644 --- a/docs/build/html/_modules/pyFTS/common/Util.html +++ b/docs/build/html/_modules/pyFTS/common/Util.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.Util — pyFTS 1.2.3 documentation + pyFTS.common.Util — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -422,7 +422,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/flrg.html b/docs/build/html/_modules/pyFTS/common/flrg.html index eac199c..9c486d8 100644 --- a/docs/build/html/_modules/pyFTS/common/flrg.html +++ b/docs/build/html/_modules/pyFTS/common/flrg.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.flrg — pyFTS 1.2.3 documentation + pyFTS.common.flrg — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -198,7 +198,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/fts.html b/docs/build/html/_modules/pyFTS/common/fts.html index 9baf4b4..1580953 100644 --- a/docs/build/html/_modules/pyFTS/common/fts.html +++ b/docs/build/html/_modules/pyFTS/common/fts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.fts — pyFTS 1.2.3 documentation + pyFTS.common.fts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -532,14 +532,19 @@ return data
    [docs] def get_UoD(self): - return [self.original_min, self.original_max]
    + #return [self.original_min, self.original_max] + return [self.partitioner.min, self.partitioner.max] def __str__(self): """String representation of the model""" tmp = self.name + ":\n" - for r in sorted(self.flrgs, key=lambda key: self.flrgs[key].get_midpoint(self.sets)): - tmp = tmp + str(self.flrgs[r]) + "\n" + if self.partitioner.type == 'common': + for r in sorted(self.flrgs, key=lambda key: self.flrgs[key].get_midpoint(self.partitioner.sets)): + tmp = "{0}{1}\n".format(tmp, str(self.flrgs[r])) + else: + for r in self.model.flrgs: + tmp = "{0}{1}\n".format(tmp, str(self.flrgs[r])) return tmp def __len__(self): @@ -575,7 +580,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/common/tree.html b/docs/build/html/_modules/pyFTS/common/tree.html index ffaf2be..65bfb43 100644 --- a/docs/build/html/_modules/pyFTS/common/tree.html +++ b/docs/build/html/_modules/pyFTS/common/tree.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.common.tree — pyFTS 1.2.3 documentation + pyFTS.common.tree — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -161,7 +161,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/AirPassengers.html b/docs/build/html/_modules/pyFTS/data/AirPassengers.html index e189799..398f87e 100644 --- a/docs/build/html/_modules/pyFTS/data/AirPassengers.html +++ b/docs/build/html/_modules/pyFTS/data/AirPassengers.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.AirPassengers — pyFTS 1.2.3 documentation + pyFTS.data.AirPassengers — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -120,7 +120,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/Bitcoin.html b/docs/build/html/_modules/pyFTS/data/Bitcoin.html index e73f8a0..353f0ee 100644 --- a/docs/build/html/_modules/pyFTS/data/Bitcoin.html +++ b/docs/build/html/_modules/pyFTS/data/Bitcoin.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.Bitcoin — pyFTS 1.2.3 documentation + pyFTS.data.Bitcoin — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -123,7 +123,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/DowJones.html b/docs/build/html/_modules/pyFTS/data/DowJones.html index 74fa6ab..623e7d5 100644 --- a/docs/build/html/_modules/pyFTS/data/DowJones.html +++ b/docs/build/html/_modules/pyFTS/data/DowJones.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.DowJones — pyFTS 1.2.3 documentation + pyFTS.data.DowJones — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -124,7 +124,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/EURGBP.html b/docs/build/html/_modules/pyFTS/data/EURGBP.html index a0f7a0f..0e47d20 100644 --- a/docs/build/html/_modules/pyFTS/data/EURGBP.html +++ b/docs/build/html/_modules/pyFTS/data/EURGBP.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.EURGBP — pyFTS 1.2.3 documentation + pyFTS.data.EURGBP — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -122,7 +122,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/EURUSD.html b/docs/build/html/_modules/pyFTS/data/EURUSD.html index d09be89..fbd1eec 100644 --- a/docs/build/html/_modules/pyFTS/data/EURUSD.html +++ b/docs/build/html/_modules/pyFTS/data/EURUSD.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.EURUSD — pyFTS 1.2.3 documentation + pyFTS.data.EURUSD — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -122,7 +122,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/Enrollments.html b/docs/build/html/_modules/pyFTS/data/Enrollments.html index 6d30066..bd51000 100644 --- a/docs/build/html/_modules/pyFTS/data/Enrollments.html +++ b/docs/build/html/_modules/pyFTS/data/Enrollments.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.Enrollments — pyFTS 1.2.3 documentation + pyFTS.data.Enrollments — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -113,7 +113,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/Ethereum.html b/docs/build/html/_modules/pyFTS/data/Ethereum.html index 629d0b4..7c9439f 100644 --- a/docs/build/html/_modules/pyFTS/data/Ethereum.html +++ b/docs/build/html/_modules/pyFTS/data/Ethereum.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.Ethereum — pyFTS 1.2.3 documentation + pyFTS.data.Ethereum — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -124,7 +124,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/GBPUSD.html b/docs/build/html/_modules/pyFTS/data/GBPUSD.html index bf09ef3..372ada2 100644 --- a/docs/build/html/_modules/pyFTS/data/GBPUSD.html +++ b/docs/build/html/_modules/pyFTS/data/GBPUSD.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.GBPUSD — pyFTS 1.2.3 documentation + pyFTS.data.GBPUSD — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -122,7 +122,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/INMET.html b/docs/build/html/_modules/pyFTS/data/INMET.html index a4b1285..369b491 100644 --- a/docs/build/html/_modules/pyFTS/data/INMET.html +++ b/docs/build/html/_modules/pyFTS/data/INMET.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.INMET — pyFTS 1.2.3 documentation + pyFTS.data.INMET — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -111,7 +111,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/Malaysia.html b/docs/build/html/_modules/pyFTS/data/Malaysia.html index 859c1b5..174e6ac 100644 --- a/docs/build/html/_modules/pyFTS/data/Malaysia.html +++ b/docs/build/html/_modules/pyFTS/data/Malaysia.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.Malaysia — pyFTS 1.2.3 documentation + pyFTS.data.Malaysia — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -122,7 +122,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/NASDAQ.html b/docs/build/html/_modules/pyFTS/data/NASDAQ.html index 13699f0..60d0a20 100644 --- a/docs/build/html/_modules/pyFTS/data/NASDAQ.html +++ b/docs/build/html/_modules/pyFTS/data/NASDAQ.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.NASDAQ — pyFTS 1.2.3 documentation + pyFTS.data.NASDAQ — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -124,7 +124,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/SONDA.html b/docs/build/html/_modules/pyFTS/data/SONDA.html index d4a8a6d..82f7cfc 100644 --- a/docs/build/html/_modules/pyFTS/data/SONDA.html +++ b/docs/build/html/_modules/pyFTS/data/SONDA.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.SONDA — pyFTS 1.2.3 documentation + pyFTS.data.SONDA — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -125,7 +125,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/SP500.html b/docs/build/html/_modules/pyFTS/data/SP500.html index b391fb9..21079f1 100644 --- a/docs/build/html/_modules/pyFTS/data/SP500.html +++ b/docs/build/html/_modules/pyFTS/data/SP500.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.SP500 — pyFTS 1.2.3 documentation + pyFTS.data.SP500 — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -122,7 +122,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/TAIEX.html b/docs/build/html/_modules/pyFTS/data/TAIEX.html index a1e1692..e3839a8 100644 --- a/docs/build/html/_modules/pyFTS/data/TAIEX.html +++ b/docs/build/html/_modules/pyFTS/data/TAIEX.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.TAIEX — pyFTS 1.2.3 documentation + pyFTS.data.TAIEX — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -123,7 +123,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/artificial.html b/docs/build/html/_modules/pyFTS/data/artificial.html index 58f7d57..de1b772 100644 --- a/docs/build/html/_modules/pyFTS/data/artificial.html +++ b/docs/build/html/_modules/pyFTS/data/artificial.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.artificial — pyFTS 1.2.3 documentation + pyFTS.data.artificial — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -168,7 +168,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/common.html b/docs/build/html/_modules/pyFTS/data/common.html index 0fabe9b..1d812db 100644 --- a/docs/build/html/_modules/pyFTS/data/common.html +++ b/docs/build/html/_modules/pyFTS/data/common.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.common — pyFTS 1.2.3 documentation + pyFTS.data.common — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -118,7 +118,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/henon.html b/docs/build/html/_modules/pyFTS/data/henon.html index d787710..fc97609 100644 --- a/docs/build/html/_modules/pyFTS/data/henon.html +++ b/docs/build/html/_modules/pyFTS/data/henon.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.henon — pyFTS 1.2.3 documentation + pyFTS.data.henon — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -128,7 +128,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/logistic_map.html b/docs/build/html/_modules/pyFTS/data/logistic_map.html index 968c2f8..f902145 100644 --- a/docs/build/html/_modules/pyFTS/data/logistic_map.html +++ b/docs/build/html/_modules/pyFTS/data/logistic_map.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.logistic_map — pyFTS 1.2.3 documentation + pyFTS.data.logistic_map — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -112,7 +112,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/lorentz.html b/docs/build/html/_modules/pyFTS/data/lorentz.html index 8c138a2..ffbfe0f 100644 --- a/docs/build/html/_modules/pyFTS/data/lorentz.html +++ b/docs/build/html/_modules/pyFTS/data/lorentz.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.lorentz — pyFTS 1.2.3 documentation + pyFTS.data.lorentz — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -139,7 +139,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/mackey_glass.html b/docs/build/html/_modules/pyFTS/data/mackey_glass.html index 79325cb..023b137 100644 --- a/docs/build/html/_modules/pyFTS/data/mackey_glass.html +++ b/docs/build/html/_modules/pyFTS/data/mackey_glass.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.mackey_glass — pyFTS 1.2.3 documentation + pyFTS.data.mackey_glass — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -115,7 +115,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/rossler.html b/docs/build/html/_modules/pyFTS/data/rossler.html index 088500a..2079f9e 100644 --- a/docs/build/html/_modules/pyFTS/data/rossler.html +++ b/docs/build/html/_modules/pyFTS/data/rossler.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.rossler — pyFTS 1.2.3 documentation + pyFTS.data.rossler — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -139,7 +139,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/data/sunspots.html b/docs/build/html/_modules/pyFTS/data/sunspots.html index e0a2738..c873276 100644 --- a/docs/build/html/_modules/pyFTS/data/sunspots.html +++ b/docs/build/html/_modules/pyFTS/data/sunspots.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.data.sunspots — pyFTS 1.2.3 documentation + pyFTS.data.sunspots — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -119,7 +119,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/hyperparam/GridSearch.html b/docs/build/html/_modules/pyFTS/hyperparam/GridSearch.html index 0f530fa..16a8ccb 100644 --- a/docs/build/html/_modules/pyFTS/hyperparam/GridSearch.html +++ b/docs/build/html/_modules/pyFTS/hyperparam/GridSearch.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.hyperparam.GridSearch — pyFTS 1.2.3 documentation + pyFTS.hyperparam.GridSearch — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -94,7 +94,7 @@ } -
    [docs]def metodo_cluster(individual, train, test): +
    [docs]def cluster_method(individual, train, test): from pyFTS.common import Util, Membership from pyFTS.models import hofts from pyFTS.partitioners import Grid, Entropy @@ -116,7 +116,7 @@ partitioner = Entropy.EntropyPartitioner(data=train, npart=npart, func=mf) - model = hofts.HighOrderFTS(partitioner=partitioner, + model = hofts.WeightedHighOrderFTS(partitioner=partitioner, lags=individual['lags'], alpha_cut=individual['alpha'], order=individual['order']) @@ -125,8 +125,33 @@ rmse, mape, u = Measures.get_point_statistics(test, model) - return individual, rmse
    + size = len(model) + return individual, rmse, size, mape, u
    + + +
    [docs]def process_jobs(jobs, datasetname, conn): + for job in jobs: + result, rmse, size, mape, u = job() + if job.status == dispy.DispyJob.Finished and result is not None: + print("Processing result of {}".format(result)) + + metrics = {'rmse': rmse, 'size': size, 'mape': mape, 'u': u } + + for metric in metrics.keys(): + + record = (datasetname, 'GridSearch', 'WHOFTS', None, result['mf'], + result['order'], result['partitioner'], result['npart'], + result['alpha'], str(result['lags']), metric, metrics[metric]) + + print(record) + + hUtil.insert_hyperparam(record, conn) + + else: + print(job.exception) + print(job.stdout)
    +
    [docs]def execute(hyperparams, datasetname, train, test, **kwargs): @@ -144,11 +169,18 @@ index = {} for k in np.arange(len(keys_sorted)): index[keys_sorted[k]] = k + + print("Evaluation order: \n {}".format(index)) hp_values = [ [v for v in hyperparams[hp]] for hp in keys_sorted ] + + print("Evaluation values: \n {}".format(hp_values)) + + cluster, http_server = Util.start_dispy_cluster(cluster_method, nodes=nodes) + conn = hUtil.open_hyperparam_db('hyperparam.db') for instance in product(*hp_values): partitions = instance[index['partitions']] @@ -156,13 +188,17 @@ mf = instance[index['mf']] alpha_cut = instance[index['alpha']] order = instance[index['order']] + count = 0 for lag1 in lags: # o é o lag1 _lags = [lag1] + count += 1 if order > 1: for lag2 in lags: # o é o lag1 _lags2 = [lag1, lag1+lag2] + count += 1 if order > 2: for lag3 in lags: # o é o lag1 + count += 1 _lags3 = [lag1, lag1 + lag2, lag1 + lag2+lag3 ] individuals.append(dict_individual(mf, partitioner, partitions, order, _lags3, alpha_cut)) else: @@ -170,33 +206,20 @@ dict_individual(mf, partitioner, partitions, order, _lags2, alpha_cut)) else: individuals.append(dict_individual(mf, partitioner, partitions, order, _lags, alpha_cut)) + + if count > 50: + jobs = [] - - cluster, http_server = Util.start_dispy_cluster(metodo_cluster, nodes=nodes) - - jobs = [] - - for ind in individuals: - job = cluster.submit(ind, train, test) - jobs.append(job) - - - conn = hUtil.open_hyperparam_db('hyperparam.db') - - for job in jobs: - result, rmse = job() - if job.status == dispy.DispyJob.Finished and result is not None: - print(result) - - record = (datasetname, 'GridSearch', 'HOFTS', None, result['mf'], - result['order'], result['partitioner'], result['npart'], - result['alpha'], str(result['lags']), 'rmse', rmse) - - hUtil.insert_hyperparam(record, conn) - - else: - print(job.exception) - print(job.stdout) + for ind in individuals: + print("Testing individual {}".format(ind)) + job = cluster.submit(ind, train, test) + jobs.append(job) + + process_jobs(jobs, datasetname, conn) + + count = 0 + + individuals = [] Util.stop_dispy_cluster(cluster, http_server)
    @@ -215,7 +238,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/hyperparam/Util.html b/docs/build/html/_modules/pyFTS/hyperparam/Util.html index 9699c13..b050166 100644 --- a/docs/build/html/_modules/pyFTS/hyperparam/Util.html +++ b/docs/build/html/_modules/pyFTS/hyperparam/Util.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.hyperparam.Util — pyFTS 1.2.3 documentation + pyFTS.hyperparam.Util — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -157,7 +157,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/chen.html b/docs/build/html/_modules/pyFTS/models/chen.html index 781e000..7fc1d9b 100644 --- a/docs/build/html/_modules/pyFTS/models/chen.html +++ b/docs/build/html/_modules/pyFTS/models/chen.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.chen — pyFTS 1.2.3 documentation + pyFTS.models.chen — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -178,7 +178,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/cheng.html b/docs/build/html/_modules/pyFTS/models/cheng.html index be49c3e..5a224c8 100644 --- a/docs/build/html/_modules/pyFTS/models/cheng.html +++ b/docs/build/html/_modules/pyFTS/models/cheng.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.cheng — pyFTS 1.2.3 documentation + pyFTS.models.cheng — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -149,7 +149,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/ensemble/ensemble.html b/docs/build/html/_modules/pyFTS/models/ensemble/ensemble.html index 7e3e90a..973112c 100644 --- a/docs/build/html/_modules/pyFTS/models/ensemble/ensemble.html +++ b/docs/build/html/_modules/pyFTS/models/ensemble/ensemble.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.ensemble.ensemble — pyFTS 1.2.3 documentation + pyFTS.models.ensemble.ensemble — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -402,7 +402,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/ensemble/multiseasonal.html b/docs/build/html/_modules/pyFTS/models/ensemble/multiseasonal.html index 3cd0f9b..1be783b 100644 --- a/docs/build/html/_modules/pyFTS/models/ensemble/multiseasonal.html +++ b/docs/build/html/_modules/pyFTS/models/ensemble/multiseasonal.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.ensemble.multiseasonal — pyFTS 1.2.3 documentation + pyFTS.models.ensemble.multiseasonal — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -181,7 +181,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/hofts.html b/docs/build/html/_modules/pyFTS/models/hofts.html index 74f4391..a768dda 100644 --- a/docs/build/html/_modules/pyFTS/models/hofts.html +++ b/docs/build/html/_modules/pyFTS/models/hofts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.hofts — pyFTS 1.2.3 documentation + pyFTS.models.hofts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -80,7 +80,8 @@ """ import numpy as np -from pyFTS.common import FuzzySet, FLR, fts, flrg, tree +from pyFTS.common import FuzzySet, FLR, fts, flrg +from itertools import product
    [docs]class HighOrderFLRG(flrg.FLRG): """Conventional High Order Fuzzy Logical Relationship Group""" @@ -161,13 +162,13 @@ self.detail = "Severiano, Silva, Sadaei and Guimarães" self.is_high_order = True self.min_order = 1 - self.order= kwargs.get("order", 2) + self.order= kwargs.get("order", self.min_order) self.lags = kwargs.get("lags", None) self.configure_lags(**kwargs)
    [docs] def configure_lags(self, **kwargs): if "order" in kwargs: - self.order = kwargs.get("order", 2) + self.order = kwargs.get("order", self.min_order) if "lags" in kwargs: self.lags = kwargs.get("lags", None) @@ -180,30 +181,25 @@
    [docs] def generate_lhs_flrg(self, sample, explain=False): - nsample = [FuzzySet.fuzzyfy(k, partitioner=self.partitioner, mode="sets", alpha_cut=self.alpha_cut) + nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut) for k in sample] return self.generate_lhs_flrg_fuzzyfied(nsample, explain)
    [docs] def generate_lhs_flrg_fuzzyfied(self, sample, explain=False): - lags = {} - + lags = [] flrgs = [] for ct, o in enumerate(self.lags): - lags[ct] = sample[o-1] + lhs = sample[o - 1] + lags.append(lhs) if explain: print("\t (Lag {}) {} -> {} \n".format(o, sample[o-1], lhs)) - root = tree.FLRGTreeNode(None) - - tree.build_tree_without_order(root, lags, 0) - # Trace the possible paths - for p in root.paths(): + for path in product(*lags): flrg = HighOrderFLRG(self.order) - path = list(reversed(list(filter(None.__ne__, p)))) for lhs in path: flrg.append_lhs(lhs) @@ -215,25 +211,23 @@
    [docs] def generate_flrg(self, data): l = len(data) for k in np.arange(self.max_lag, l): - lags = {} if self.dump: print("FLR: " + str(k)) sample = data[k - self.max_lag: k] - print(sample) - rhs = FuzzySet.fuzzyfy(data[k], partitioner=self.partitioner, mode="sets", alpha_cut=self.alpha_cut) + rhs = self.partitioner.fuzzyfy(data[k], mode="sets", alpha_cut=self.alpha_cut) flrgs = self.generate_lhs_flrg(sample) for flrg in flrgs: - print('key', flrg.get_key()) if flrg.get_key() not in self.flrgs: self.flrgs[flrg.get_key()] = flrg; for st in rhs: self.flrgs[flrg.get_key()].append_rhs(st)
    +
    [docs] def generate_flrg_fuzzyfied(self, data): l = len(data) for k in np.arange(self.max_lag, l): @@ -241,7 +235,6 @@ sample = data[k - self.max_lag: k] - rhs = data[k] flrgs = self.generate_lhs_flrg_fuzzyfied(sample) @@ -321,24 +314,18 @@ self.shortname = "WHOFTS"
    [docs] def generate_lhs_flrg_fuzzyfied(self, sample, explain=False): - lags = {} - + lags = [] flrgs = [] for ct, o in enumerate(self.lags): - lags[ct] = sample[o-1] + lags.append(sample[o-1]) if explain: - print("\t (Lag {}) {} -> {} \n".format(o, sample[o-1], lhs)) - - root = tree.FLRGTreeNode(None) - - tree.build_tree_without_order(root, lags, 0) + print("\t (Lag {}) {} \n".format(o, sample[o-1])) # Trace the possible paths - for p in root.paths(): + for path in product(*lags): flrg = WeightedHighOrderFLRG(self.order) - path = list(reversed(list(filter(None.__ne__, p)))) for lhs in path: flrg.append_lhs(lhs) @@ -362,7 +349,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/hwang.html b/docs/build/html/_modules/pyFTS/models/hwang.html index 72f9185..2d0475a 100644 --- a/docs/build/html/_modules/pyFTS/models/hwang.html +++ b/docs/build/html/_modules/pyFTS/models/hwang.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.hwang — pyFTS 1.2.3 documentation + pyFTS.models.hwang — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - +
    @@ -153,7 +153,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/ifts.html b/docs/build/html/_modules/pyFTS/models/ifts.html index c9ee781..90b8359 100644 --- a/docs/build/html/_modules/pyFTS/models/ifts.html +++ b/docs/build/html/_modules/pyFTS/models/ifts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.ifts — pyFTS 1.2.3 documentation + pyFTS.models.ifts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - +
    @@ -177,7 +177,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/incremental/Retrainer.html b/docs/build/html/_modules/pyFTS/models/incremental/Retrainer.html index 6762c3e..07d37d1 100644 --- a/docs/build/html/_modules/pyFTS/models/incremental/Retrainer.html +++ b/docs/build/html/_modules/pyFTS/models/incremental/Retrainer.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.incremental.Retrainer — pyFTS 1.2.3 documentation + pyFTS.models.incremental.Retrainer — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -170,7 +170,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/ismailefendi.html b/docs/build/html/_modules/pyFTS/models/ismailefendi.html index f544092..14c579e 100644 --- a/docs/build/html/_modules/pyFTS/models/ismailefendi.html +++ b/docs/build/html/_modules/pyFTS/models/ismailefendi.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.ismailefendi — pyFTS 1.2.3 documentation + pyFTS.models.ismailefendi — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -199,7 +199,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/FLR.html b/docs/build/html/_modules/pyFTS/models/multivariate/FLR.html index e6b88c3..8129807 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/FLR.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/FLR.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.FLR — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.FLR — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -113,7 +113,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/cmvfts.html b/docs/build/html/_modules/pyFTS/models/multivariate/cmvfts.html index d0a5c22..bcb40d8 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/cmvfts.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/cmvfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.cmvfts — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.cmvfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -90,8 +90,8 @@ """The cluster method to be called when a new model is build""" self.cluster_params = kwargs.get('cluster_params', {}) """The cluster method parameters""" - self.cluster = None - """The most recent trained clusterer""" + self.cluster = kwargs.get('cluster', None) + """The trained clusterer""" self.fts_method = kwargs.get('fts_method', hofts.WeightedHighOrderFTS) """The FTS method to be called when a new model is build""" @@ -110,42 +110,46 @@ self.shortname = "ClusteredMVFTS" self.name = "Clustered Multivariate FTS" + self.pre_fuzzyfy = kwargs.get('pre_fuzzyfy', True) +
    [docs] def fuzzyfy(self,data): ndata = [] - for ct in range(1, len(data.index)+1): - ix = data.index[ct - 1] - data_point = self.format_data(data.loc[ix]) - ndata.append(common.fuzzyfy_instance_clustered(data_point, self.cluster, self.alpha_cut)) + for index, row in data.iterrows(): + data_point = self.format_data(row) + ndata.append(common.fuzzyfy_instance_clustered(data_point, self.cluster, alpha_cut=self.alpha_cut)) return ndata
    -
    [docs] def train(self, data, **kwargs): - self.cluster = self.cluster_method(data=data, mvfts=self, neighbors=self.knn) + if self.cluster is None: + self.cluster = self.cluster_method(data=data, mvfts=self, neighbors=self.knn, **self.cluster_params) self.model = self.fts_method(partitioner=self.cluster, **self.fts_params) if self.model.is_high_order: - self.model.order = self.model = self.fts_method(partitioner=self.cluster, - order=self.order, **self.fts_params) + self.model.order = self.order - ndata = self.fuzzyfy(data) + if self.pre_fuzzyfy: + ndata = self.fuzzyfy(data) + else: + ndata = [self.format_data(k) for k in data.to_dict('records')] - self.model.train(ndata, fuzzyfied=True)
    + self.model.train(ndata, fuzzyfied=self.pre_fuzzyfy) + + self.cluster.prune()
    [docs] def forecast(self, ndata, **kwargs): - ndata = self.fuzzyfy(ndata) + if self.pre_fuzzyfy: + ndata = self.fuzzyfy(ndata) + else: + ndata = [self.format_data(k) for k in ndata.to_dict('records')] - return self.model.forecast(ndata, fuzzyfied=True, **kwargs)
    + return self.model.forecast(ndata, fuzzyfied=self.pre_fuzzyfy, **kwargs) def __str__(self): """String representation of the model""" - - tmp = self.model.shortname + ":\n" - for r in self.model.flrgs: - tmp = tmp + str(self.model.flrgs[r]) + "\n" - return tmp + return str(self.model) def __len__(self): """ @@ -171,7 +175,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/common.html b/docs/build/html/_modules/pyFTS/models/multivariate/common.html index 21d31c7..97818ef 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/common.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/common.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.common — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.common — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -116,11 +116,16 @@ return [(var.name, fs) for fs in fsets] -
    [docs]def fuzzyfy_instance_clustered(data_point, cluster, alpha_cut=0.0): +
    [docs]def fuzzyfy_instance_clustered(data_point, cluster, **kwargs): + alpha_cut = kwargs.get('alpha_cut', 0.0) + mode = kwargs.get('mode', 'sets') fsets = [] for fset in cluster.knn(data_point): if cluster.sets[fset].membership(data_point) > alpha_cut: - fsets.append(fset) + if mode == 'sets': + fsets.append(fset) + elif mode =='both': + fsets.append( (fset, cluster.sets[fset].membership(data_point)) ) return fsets
    @@ -141,7 +146,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/flrg.html b/docs/build/html/_modules/pyFTS/models/multivariate/flrg.html index e585d62..7767f05 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/flrg.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/flrg.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.flrg — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.flrg — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -131,7 +131,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/mvfts.html b/docs/build/html/_modules/pyFTS/models/multivariate/mvfts.html index aa7b0ce..c8a036e 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/mvfts.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/mvfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.mvfts — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.mvfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -105,14 +105,19 @@
    [docs] def format_data(self, data): ndata = {} for var in self.explanatory_variables: - ndata[var.name] = data[var.data_label] + #ndata[var.name] = data[var.data_label] + ndata[var.name] = var.partitioner.extractor(data[var.data_label]) return ndata
    [docs] def apply_transformations(self, data, params=None, updateUoD=False, **kwargs): ndata = data.copy(deep=True) for var in self.explanatory_variables: - ndata[var.data_label] = var.apply_transformations(data[var.data_label].values) + if self.uod_clip and var.partitioner.type == 'common': + ndata[var.data_label] = np.clip(ndata[var.data_label].values, + var.partitioner.min, var.partitioner.max) + + ndata[var.data_label] = var.apply_transformations(ndata[var.data_label].values) return ndata
    @@ -179,9 +184,8 @@
    [docs] def forecast(self, data, **kwargs): ret = [] ndata = self.apply_transformations(data) - for ix in ndata.index: - data_point = ndata.loc[ix] - flrs = self.generate_lhs_flrs(data_point) + for index, row in ndata.iterrows(): + flrs = self.generate_lhs_flrs(row) mvs = [] mps = [] for flr in flrs: @@ -190,7 +194,7 @@ mvs.append(0.) mps.append(0.) else: - mvs.append(self.flrgs[flrg.get_key()].get_membership(self.format_data(data_point), self.explanatory_variables)) + mvs.append(self.flrgs[flrg.get_key()].get_membership(self.format_data(row), self.explanatory_variables)) mps.append(self.flrgs[flrg.get_key()].get_midpoint(self.target_variable.partitioner.sets)) mv = np.array(mvs) @@ -204,7 +208,6 @@
    [docs] def forecast_ahead(self, data, steps, **kwargs): generators = kwargs.get('generators',None) - start = kwargs.get('start', 0) if generators is None: raise Exception('You must provide parameter \'generators\'! generators is a dict where the keys' + @@ -270,7 +273,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/variable.html b/docs/build/html/_modules/pyFTS/models/multivariate/variable.html index 382b169..5b53f4f 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/variable.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/variable.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.variable — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.variable — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - +
    @@ -161,7 +161,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/multivariate/wmvfts.html b/docs/build/html/_modules/pyFTS/models/multivariate/wmvfts.html index 1b0b886..5f09113 100644 --- a/docs/build/html/_modules/pyFTS/models/multivariate/wmvfts.html +++ b/docs/build/html/_modules/pyFTS/models/multivariate/wmvfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.multivariate.wmvfts — pyFTS 1.2.3 documentation + pyFTS.models.multivariate.wmvfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -156,7 +156,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/common.html b/docs/build/html/_modules/pyFTS/models/nonstationary/common.html index 04f922c..0066544 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/common.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/common.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.common — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.common — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -331,7 +331,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/cvfts.html b/docs/build/html/_modules/pyFTS/models/nonstationary/cvfts.html index 46d4409..e509bb8 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/cvfts.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/cvfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.cvfts — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.cvfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -359,7 +359,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/flrg.html b/docs/build/html/_modules/pyFTS/models/nonstationary/flrg.html index 1aa2f30..6ae1d36 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/flrg.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/flrg.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.flrg — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.flrg — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -162,7 +162,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/honsfts.html b/docs/build/html/_modules/pyFTS/models/nonstationary/honsfts.html index 3ee1306..8fa2c27 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/honsfts.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/honsfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.honsfts — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.honsfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -337,7 +337,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/nsfts.html b/docs/build/html/_modules/pyFTS/models/nonstationary/nsfts.html index b771fa7..4cc2925 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/nsfts.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/nsfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.nsfts — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.nsfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -362,7 +362,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/partitioners.html b/docs/build/html/_modules/pyFTS/models/nonstationary/partitioners.html index f19aeea..9a979fb 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/partitioners.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/partitioners.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.partitioners — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.partitioners — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -237,7 +237,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/perturbation.html b/docs/build/html/_modules/pyFTS/models/nonstationary/perturbation.html index 38c2a73..0cbec6b 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/perturbation.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/perturbation.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.perturbation — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.perturbation — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -111,7 +111,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/nonstationary/util.html b/docs/build/html/_modules/pyFTS/models/nonstationary/util.html index ba215f5..9fba6a9 100644 --- a/docs/build/html/_modules/pyFTS/models/nonstationary/util.html +++ b/docs/build/html/_modules/pyFTS/models/nonstationary/util.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.nonstationary.util — pyFTS 1.2.3 documentation + pyFTS.models.nonstationary.util — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -182,7 +182,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/pwfts.html b/docs/build/html/_modules/pyFTS/models/pwfts.html index cf63345..593f10c 100644 --- a/docs/build/html/_modules/pyFTS/models/pwfts.html +++ b/docs/build/html/_modules/pyFTS/models/pwfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.pwfts — pyFTS 1.2.3 documentation + pyFTS.models.pwfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -79,9 +79,10 @@ import pandas as pd import math from operator import itemgetter -from pyFTS.common import FLR, FuzzySet, tree +from pyFTS.common import FLR, FuzzySet from pyFTS.models import hofts, ifts from pyFTS.probabilistic import ProbabilityDistribution +from itertools import product
    [docs]class ProbabilisticWeightedFLRG(hofts.HighOrderFLRG): @@ -190,33 +191,33 @@ parameters = kwargs.get('parameters','fuzzy') if parameters == 'monotonic': - tmpdata = FuzzySet.fuzzyfy_series_old(data, self.sets) + tmpdata = self.partitioner.fuzzyfy(data, mode='sets', method='maximum') flrs = FLR.generate_recurrent_flrs(tmpdata) - self.generateFLRG(flrs) + self.generate_flrg(flrs) else: self.generate_flrg(data)
    [docs] def generate_lhs_flrg(self, sample, explain=False): - lags = {} + nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut) + for k in sample] + + return self.generate_lhs_flrg_fuzzyfied(nsample, explain)
    + +
    [docs] def generate_lhs_flrg_fuzzyfied(self, sample, explain=False): + lags = [] flrgs = [] for ct, o in enumerate(self.lags): - lhs = FuzzySet.fuzzyfy(sample[o - 1], partitioner=self.partitioner, mode="sets", alpha_cut=self.alpha_cut) - - lags[ct] = lhs + lhs = sample[o - 1] + lags.append( lhs ) if explain: print("\t (Lag {}) {} -> {} \n".format(o, sample[o-1], lhs)) - root = tree.FLRGTreeNode(None) - - tree.build_tree_without_order(root, lags, 0) - # Trace the possible paths - for p in root.paths(): + for path in product(*lags): flrg = ProbabilisticWeightedFLRG(self.order) - path = list(reversed(list(filter(None.__ne__, p)))) for lhs in path: flrg.append_lhs(lhs) @@ -236,14 +237,13 @@ for flrg in flrgs: - lhs_mv = flrg.get_membership(sample, self.sets) + lhs_mv = flrg.get_membership(sample, self.partitioner.sets) if flrg.get_key() not in self.flrgs: self.flrgs[flrg.get_key()] = flrg; - fuzzyfied = [(s, self.sets[s].membership(data[k])) - for s in self.sets.keys() - if self.sets[s].membership(data[k]) > self.alpha_cut] + fuzzyfied = self.partitioner.fuzzyfy(data[k], mode='both', method='fuzzy', + alpha_cut=self.alpha_cut) mvs = [] for set, mv in fuzzyfied: @@ -575,28 +575,23 @@ for k in np.arange(self.max_lag+1, steps+self.max_lag+1): dist = ProbabilityDistribution.ProbabilityDistribution(smooth, uod=uod, bins=_bins, **kwargs) - lags = {} + lags = [] # Find all bins of past distributions with probability greater than zero - for ct, d in enumerate(self.lags): - dd = ret[k - d] - vals = [float(v) for v in dd.bins if round(dd.density(v), 4) > 0] - lags[ct] = sorted(vals) + for ct, lag in enumerate(self.lags): + dd = ret[k - lag] + vals = [float(v) for v in dd.bins if np.round(dd.density(v), 4) > 0.0] + lags.append( sorted(vals) ) - root = tree.FLRGTreeNode(None) - - tree.build_tree_without_order(root, lags, 0) # Trace all possible combinations between the bins of past distributions - for p in root.paths(): - path = list(reversed(list(filter(None.__ne__, p)))) + for path in product(*lags): # get the combined probabilities for this path - - pk = np.prod([ret[k - self.max_lag + o].density(path[ct]) - for ct, o in enumerate(self.lags)]) + pk = np.prod([ret[k - (self.max_lag + lag)].density(path[ct]) + for ct, lag in enumerate(self.lags)]) d = self.forecast_distribution(path)[0] @@ -666,7 +661,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/sadaei.html b/docs/build/html/_modules/pyFTS/models/sadaei.html index f924f41..58876cf 100644 --- a/docs/build/html/_modules/pyFTS/models/sadaei.html +++ b/docs/build/html/_modules/pyFTS/models/sadaei.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.sadaei — pyFTS 1.2.3 documentation + pyFTS.models.sadaei — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -203,7 +203,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/seasonal/SeasonalIndexer.html b/docs/build/html/_modules/pyFTS/models/seasonal/SeasonalIndexer.html index 2b9652a..ac1be76 100644 --- a/docs/build/html/_modules/pyFTS/models/seasonal/SeasonalIndexer.html +++ b/docs/build/html/_modules/pyFTS/models/seasonal/SeasonalIndexer.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.seasonal.SeasonalIndexer — pyFTS 1.2.3 documentation + pyFTS.models.seasonal.SeasonalIndexer — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -290,7 +290,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/seasonal/cmsfts.html b/docs/build/html/_modules/pyFTS/models/seasonal/cmsfts.html index be38c41..1d02b0f 100644 --- a/docs/build/html/_modules/pyFTS/models/seasonal/cmsfts.html +++ b/docs/build/html/_modules/pyFTS/models/seasonal/cmsfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.seasonal.cmsfts — pyFTS 1.2.3 documentation + pyFTS.models.seasonal.cmsfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -198,7 +198,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/seasonal/common.html b/docs/build/html/_modules/pyFTS/models/seasonal/common.html index 3c30703..af960ab 100644 --- a/docs/build/html/_modules/pyFTS/models/seasonal/common.html +++ b/docs/build/html/_modules/pyFTS/models/seasonal/common.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.seasonal.common — pyFTS 1.2.3 documentation + pyFTS.models.seasonal.common — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -77,6 +77,8 @@ from enum import Enum from pyFTS.common import FuzzySet, Membership from pyFTS.partitioners import partitioner, Grid +from datetime import date as dt +
    [docs]class DateTime(Enum): @@ -168,7 +170,7 @@ self.type = kwargs.get('type', 'seasonal')
    [docs] def transform(self, x): - if self.type == 'seasonal': + if self.type == 'seasonal' and isinstance(x, (dt, pd.Timestamp)): dp = strip_datepart(x, self.datepart) else: dp = x @@ -190,7 +192,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/seasonal/msfts.html b/docs/build/html/_modules/pyFTS/models/seasonal/msfts.html index c82cc44..da8b059 100644 --- a/docs/build/html/_modules/pyFTS/models/seasonal/msfts.html +++ b/docs/build/html/_modules/pyFTS/models/seasonal/msfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.seasonal.msfts — pyFTS 1.2.3 documentation + pyFTS.models.seasonal.msfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - +
    @@ -154,7 +154,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/seasonal/partitioner.html b/docs/build/html/_modules/pyFTS/models/seasonal/partitioner.html index fd04edd..701d6e1 100644 --- a/docs/build/html/_modules/pyFTS/models/seasonal/partitioner.html +++ b/docs/build/html/_modules/pyFTS/models/seasonal/partitioner.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.seasonal.partitioner — pyFTS 1.2.3 documentation + pyFTS.models.seasonal.partitioner — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -113,6 +113,9 @@ else: self.ordered_sets = FS.set_ordered(self.sets) + if self.type == 'seasonal': + self.extractor = lambda x: strip_datepart(x, self.season) +
    [docs] def build(self, data): sets = {} @@ -220,7 +223,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/models/seasonal/sfts.html b/docs/build/html/_modules/pyFTS/models/seasonal/sfts.html index 413667d..c9ed074 100644 --- a/docs/build/html/_modules/pyFTS/models/seasonal/sfts.html +++ b/docs/build/html/_modules/pyFTS/models/seasonal/sfts.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.seasonal.sfts — pyFTS 1.2.3 documentation + pyFTS.models.seasonal.sfts — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -189,7 +189,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/song.html b/docs/build/html/_modules/pyFTS/models/song.html index 084cc08..309e7e5 100644 --- a/docs/build/html/_modules/pyFTS/models/song.html +++ b/docs/build/html/_modules/pyFTS/models/song.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.song — pyFTS 1.2.3 documentation + pyFTS.models.song — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -175,7 +175,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/models/yu.html b/docs/build/html/_modules/pyFTS/models/yu.html index b2303f4..a692035 100644 --- a/docs/build/html/_modules/pyFTS/models/yu.html +++ b/docs/build/html/_modules/pyFTS/models/yu.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.models.yu — pyFTS 1.2.3 documentation + pyFTS.models.yu — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -195,7 +195,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/CMeans.html b/docs/build/html/_modules/pyFTS/partitioners/CMeans.html index 9c330ee..9a19ca2 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/CMeans.html +++ b/docs/build/html/_modules/pyFTS/partitioners/CMeans.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.CMeans — pyFTS 1.2.3 documentation + pyFTS.partitioners.CMeans — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -185,7 +185,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/Entropy.html b/docs/build/html/_modules/pyFTS/partitioners/Entropy.html index 2670897..d685e5a 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/Entropy.html +++ b/docs/build/html/_modules/pyFTS/partitioners/Entropy.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.Entropy — pyFTS 1.2.3 documentation + pyFTS.partitioners.Entropy — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -196,7 +196,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/FCM.html b/docs/build/html/_modules/pyFTS/partitioners/FCM.html index 6d82b1b..e92b525 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/FCM.html +++ b/docs/build/html/_modules/pyFTS/partitioners/FCM.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.FCM — pyFTS 1.2.3 documentation + pyFTS.partitioners.FCM — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -224,7 +224,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/Grid.html b/docs/build/html/_modules/pyFTS/partitioners/Grid.html index 1ce490f..e5d91b5 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/Grid.html +++ b/docs/build/html/_modules/pyFTS/partitioners/Grid.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.Grid — pyFTS 1.2.3 documentation + pyFTS.partitioners.Grid — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -130,7 +130,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/Huarng.html b/docs/build/html/_modules/pyFTS/partitioners/Huarng.html index 747242b..6000319 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/Huarng.html +++ b/docs/build/html/_modules/pyFTS/partitioners/Huarng.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.Huarng — pyFTS 1.2.3 documentation + pyFTS.partitioners.Huarng — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -141,7 +141,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/Singleton.html b/docs/build/html/_modules/pyFTS/partitioners/Singleton.html index 2f62074..0d59d38 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/Singleton.html +++ b/docs/build/html/_modules/pyFTS/partitioners/Singleton.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.Singleton — pyFTS 1.2.3 documentation + pyFTS.partitioners.Singleton — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -117,7 +117,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/Util.html b/docs/build/html/_modules/pyFTS/partitioners/Util.html index 629c882..6ba4465 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/Util.html +++ b/docs/build/html/_modules/pyFTS/partitioners/Util.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.Util — pyFTS 1.2.3 documentation + pyFTS.partitioners.Util — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -177,7 +177,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/parallel_util.html b/docs/build/html/_modules/pyFTS/partitioners/parallel_util.html index 9be087a..dca20ba 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/parallel_util.html +++ b/docs/build/html/_modules/pyFTS/partitioners/parallel_util.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.parallel_util — pyFTS 1.2.3 documentation + pyFTS.partitioners.parallel_util — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -120,7 +120,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/partitioners/partitioner.html b/docs/build/html/_modules/pyFTS/partitioners/partitioner.html index c4061eb..3e14193 100644 --- a/docs/build/html/_modules/pyFTS/partitioners/partitioner.html +++ b/docs/build/html/_modules/pyFTS/partitioners/partitioner.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.partitioners.partitioner — pyFTS 1.2.3 documentation + pyFTS.partitioners.partitioner — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -104,6 +104,8 @@ """In a multivariate context, the variable that contains this partitioner""" self.type = kwargs.get('type', 'common') """The type of fuzzy sets that are generated by this partitioner""" + self.extractor = kwargs.get('extractor', lambda x: x) + """Anonymous function used to extract a single primitive type from an object instance""" self.ordered_sets = None if kwargs.get('preprocess',True): @@ -176,7 +178,10 @@ """ return self.sets[self.ordered_sets[-1]] -
    [docs] def plot(self, ax): +
    [docs] def fuzzyfy(self, data, **kwargs): + return FuzzySet.fuzzyfy(data, self, **kwargs)
    + +
    [docs] def plot(self, ax, rounding=0): """ Plot the partitioning using the Matplotlib axis ax @@ -194,7 +199,7 @@ elif s.type == 'composite': for ss in s.sets: self.plot_set(ax, ss) - ticks.append(str(round(s.centroid,0))+'\n'+s.name) + ticks.append(str(round(s.centroid,rounding))+'\n'+s.name) x.append(s.centroid) ax.xaxis.set_ticklabels(ticks) ax.xaxis.set_ticks(x)
    @@ -249,7 +254,7 @@
  • modules |
  • - +
    diff --git a/docs/build/html/_modules/pyFTS/probabilistic/ProbabilityDistribution.html b/docs/build/html/_modules/pyFTS/probabilistic/ProbabilityDistribution.html index dddb95b..3a3a99b 100644 --- a/docs/build/html/_modules/pyFTS/probabilistic/ProbabilityDistribution.html +++ b/docs/build/html/_modules/pyFTS/probabilistic/ProbabilityDistribution.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.probabilistic.ProbabilityDistribution — pyFTS 1.2.3 documentation + pyFTS.probabilistic.ProbabilityDistribution — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -423,7 +423,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_modules/pyFTS/probabilistic/kde.html b/docs/build/html/_modules/pyFTS/probabilistic/kde.html index 1b2dc6b..1e4e1e4 100644 --- a/docs/build/html/_modules/pyFTS/probabilistic/kde.html +++ b/docs/build/html/_modules/pyFTS/probabilistic/kde.html @@ -17,7 +17,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - pyFTS.probabilistic.kde — pyFTS 1.2.3 documentation + pyFTS.probabilistic.kde — pyFTS 1.4 documentation @@ -42,7 +42,7 @@
  • modules |
  • - + @@ -150,7 +150,7 @@
  • modules |
  • - + diff --git a/docs/build/html/_static/bizstyle.js b/docs/build/html/_static/bizstyle.js index cc5f1ab..9f05da5 100644 --- a/docs/build/html/_static/bizstyle.js +++ b/docs/build/html/_static/bizstyle.js @@ -36,6 +36,6 @@ $(window).resize(function(){ $("li.nav-item-0 a").text("Top"); } else { - $("li.nav-item-0 a").text("pyFTS 1.2.3 documentation"); + $("li.nav-item-0 a").text("pyFTS 1.4 documentation"); } }); \ No newline at end of file diff --git a/docs/build/html/_static/documentation_options.js b/docs/build/html/_static/documentation_options.js index 0c676dc..6a3a9e6 100644 --- a/docs/build/html/_static/documentation_options.js +++ b/docs/build/html/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: '', - VERSION: '1.2.3', + VERSION: '1.4', LANGUAGE: 'None', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', diff --git a/docs/build/html/genindex.html b/docs/build/html/genindex.html index e1d2863..5d38257 100644 --- a/docs/build/html/genindex.html +++ b/docs/build/html/genindex.html @@ -18,7 +18,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); - Index — pyFTS 1.2.3 documentation + Index — pyFTS 1.4 documentation @@ -43,7 +43,7 @@
  • modules |
  • - +