diff --git a/pyFTS/common/flrg.py b/pyFTS/common/flrg.py index 93b2788..a40d037 100644 --- a/pyFTS/common/flrg.py +++ b/pyFTS/common/flrg.py @@ -37,13 +37,9 @@ class FLRG(object): self.key = "" for n in names: - try: - if len(self.key) > 0: - self.key += "," - self.key += n - except Exception as ex: - print(self.key, n) - raise ex + if len(self.key) > 0: + self.key += "," + self.key += n return self.key def get_membership(self, data, sets): diff --git a/pyFTS/models/pwfts.py b/pyFTS/models/pwfts.py index a7ddbda..2f706bf 100644 --- a/pyFTS/models/pwfts.py +++ b/pyFTS/models/pwfts.py @@ -171,7 +171,7 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS): return np.nanprod(vals) def generate_lhs_flrg(self, sample, explain=False): - if not isinstance(sample, (list, np.ndarray)): + if not isinstance(sample, (tuple, list, np.ndarray)): sample = [sample] nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut) diff --git a/pyFTS/probabilistic/ProbabilityDistribution.py b/pyFTS/probabilistic/ProbabilityDistribution.py index 51e0854..452c6cb 100644 --- a/pyFTS/probabilistic/ProbabilityDistribution.py +++ b/pyFTS/probabilistic/ProbabilityDistribution.py @@ -211,7 +211,8 @@ class ProbabilityDistribution(object): for val in values: try: k = self.bin_index.find_ge(val) - ret.append(self.cdf[k]) + #ret.append(self.cdf[k]) + ret.append(self.cdf[val]) except: ret.append(np.nan) else: diff --git a/pyFTS/tests/general.py b/pyFTS/tests/general.py index daab88f..69a96c7 100644 --- a/pyFTS/tests/general.py +++ b/pyFTS/tests/general.py @@ -32,16 +32,15 @@ fs = Grid.GridPartitioner(data=train, npart=45) model = pwfts.ProbabilisticWeightedFTS(partitioner=fs, order=1) model.fit(train) - +horizon = 10 +''' forecasts = model.predict(test[9:20], type='point') intervals = model.predict(test[9:20], type='interval') distributions = model.predict(test[9:20], type='distribution') - -horizon = 10 - forecasts = model.predict(test[9:20], type='point', steps_ahead=horizon) intervals = model.predict(test[9:20], type='interval', steps_ahead=horizon) +''' distributions = model.predict(test[9:20], type='distribution', steps_ahead=horizon)