Several bugfixes and improvements in pwfts and ProbabilityDistribution
This commit is contained in:
parent
34ed8a1002
commit
a0468d0fed
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user