Util.plot_rules bugfix

This commit is contained in:
Petrônio Cândido 2018-06-18 13:15:34 -03:00
parent 74debe42ee
commit f9d6538bae
2 changed files with 9 additions and 7 deletions

View File

@ -10,10 +10,11 @@ import numpy as np
def plot_rules(model, size=[5, 5], axis=None, rules_by_axis=None, columns=1): def plot_rules(model, size=[5, 5], axis=None, rules_by_axis=None, columns=1):
if axis is None and rules_by_axis is None: if axis is None and rules_by_axis is None:
fig, axis = plt.subplots(nrows=1, ncols=1, figsize=size) rows = 1
elif axis is None and rules_by_axis is not None: elif axis is None and rules_by_axis is not None:
rows = (((len(model.flrgs.keys())//rules_by_axis)) // columns)+1 rows = (((len(model.flrgs.keys())//rules_by_axis)) // columns)+1
fig, axis = plt.subplots(nrows=rows, ncols=columns, figsize=size)
fig, axis = plt.subplots(nrows=rows, ncols=columns, figsize=size)
if rules_by_axis is None: if rules_by_axis is None:
draw_sets_on_axis(axis, model, size) draw_sets_on_axis(axis, model, size)
@ -31,7 +32,12 @@ def plot_rules(model, size=[5, 5], axis=None, rules_by_axis=None, columns=1):
colcount = (ct // rules_by_axis) % columns colcount = (ct // rules_by_axis) % columns
rowcount = (ct // rules_by_axis) // columns rowcount = (ct // rules_by_axis) // columns
ax = axis[rowcount, colcount] if columns > 1 else axis[rowcount] if rows > 1 and columns > 1:
ax = axis[rowcount, colcount]
elif columns > 1:
ax = axis[rowcount]
else:
ax = axis
if ct % rules_by_axis == 0: if ct % rules_by_axis == 0:
draw_sets_on_axis(ax, model, size) draw_sets_on_axis(ax, model, size)

View File

@ -69,10 +69,6 @@ class ConditionalVarianceFTS(hofts.HighOrderFTS):
self.forecasts = self.forecasts[-self.memory_window:] self.forecasts = self.forecasts[-self.memory_window:]
self.inputs = np.array(ndata[-self.memory_window:]).tolist() self.inputs = np.array(ndata[-self.memory_window:]).tolist()
print(self.mean_residual)
print(self.variance_residual)
print([self.original_min,self.original_max])
def generate_flrg(self, flrs, **kwargs): def generate_flrg(self, flrs, **kwargs):
for flr in flrs: for flr in flrs: