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 = ""
|
self.key = ""
|
||||||
|
|
||||||
for n in names:
|
for n in names:
|
||||||
try:
|
|
||||||
if len(self.key) > 0:
|
if len(self.key) > 0:
|
||||||
self.key += ","
|
self.key += ","
|
||||||
self.key += n
|
self.key += n
|
||||||
except Exception as ex:
|
|
||||||
print(self.key, n)
|
|
||||||
raise ex
|
|
||||||
return self.key
|
return self.key
|
||||||
|
|
||||||
def get_membership(self, data, sets):
|
def get_membership(self, data, sets):
|
||||||
|
@ -171,7 +171,7 @@ class ProbabilisticWeightedFTS(ifts.IntervalFTS):
|
|||||||
return np.nanprod(vals)
|
return np.nanprod(vals)
|
||||||
|
|
||||||
def generate_lhs_flrg(self, sample, explain=False):
|
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]
|
sample = [sample]
|
||||||
|
|
||||||
nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut)
|
nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut)
|
||||||
|
@ -211,7 +211,8 @@ class ProbabilityDistribution(object):
|
|||||||
for val in values:
|
for val in values:
|
||||||
try:
|
try:
|
||||||
k = self.bin_index.find_ge(val)
|
k = self.bin_index.find_ge(val)
|
||||||
ret.append(self.cdf[k])
|
#ret.append(self.cdf[k])
|
||||||
|
ret.append(self.cdf[val])
|
||||||
except:
|
except:
|
||||||
ret.append(np.nan)
|
ret.append(np.nan)
|
||||||
else:
|
else:
|
||||||
|
@ -32,16 +32,15 @@ fs = Grid.GridPartitioner(data=train, npart=45)
|
|||||||
|
|
||||||
model = pwfts.ProbabilisticWeightedFTS(partitioner=fs, order=1)
|
model = pwfts.ProbabilisticWeightedFTS(partitioner=fs, order=1)
|
||||||
model.fit(train)
|
model.fit(train)
|
||||||
|
horizon = 10
|
||||||
|
'''
|
||||||
forecasts = model.predict(test[9:20], type='point')
|
forecasts = model.predict(test[9:20], type='point')
|
||||||
intervals = model.predict(test[9:20], type='interval')
|
intervals = model.predict(test[9:20], type='interval')
|
||||||
distributions = model.predict(test[9:20], type='distribution')
|
distributions = model.predict(test[9:20], type='distribution')
|
||||||
|
|
||||||
|
|
||||||
horizon = 10
|
|
||||||
|
|
||||||
forecasts = model.predict(test[9:20], type='point', steps_ahead=horizon)
|
forecasts = model.predict(test[9:20], type='point', steps_ahead=horizon)
|
||||||
intervals = model.predict(test[9:20], type='interval', 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)
|
distributions = model.predict(test[9:20], type='distribution', steps_ahead=horizon)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user