common.plot_distributions_tiled

This commit is contained in:
Petrônio Cândido 2019-06-23 09:47:06 -03:00
parent f3cf757e96
commit 1168365a17
2 changed files with 36 additions and 2 deletions

View File

@ -163,7 +163,7 @@ def plot_distribution(ax, cmap, probabilitydist, fig, time_from, reference_data=
def plot_distribution2(probabilitydist, data, **kwargs):
"""
Plot distributions over the time (x-axis)
Plot distributions in y-axis over the time (x-axis)
:param probabilitydist: the forecasted probability distributions to plot
:param data: the original test sample
@ -226,6 +226,40 @@ def plot_distribution2(probabilitydist, data, **kwargs):
cb.set_label('Density')
def plot_distribution_tiled(distributions,data=None,rows=5,cols=5,index=None,axis=None,size=[10,20]):
"""
Plot one distribution individually in each axis, with probability in y-axis and UoD on x-axis
:param distributions:
:param data:
:param rows:
:param cols:
:param index:
:param axis:
:param size:
:return:
"""
if axis is None:
fig, axis = plt.subplots(nrows=rows, ncols=cols, figsize=size)
for ct in range(rows*cols):
col = ct % cols
row = ct // cols
if index is None:
ix = ct
else:
ix =index[ct]
forecast = distributions[ix]
forecast.plot(axis=axis[row][col])
if data is not None:
axis[row][col].axvline(data[ix])
axis[row][col].set_title('t+{}'.format(ix))
axis[row][col].set_xlabel(None)
plt.tight_layout()
def plot_interval(axis, intervals, order, label, color='red', typeonlegend=False, ls='-', linewidth=1):
"""
Plot forecasted intervals on matplotlib

View File

@ -46,7 +46,7 @@ datsetname, dataset = get_dataset()
ret = Evolutionary.execute(datsetname, dataset,
ngen=30, npop=20,psel=0.6, pcross=.5, pmut=.3,
window_size=10000, train_rate=.9, increment_rate=.3,
experiments=2,
experiments=1,
fts_method=pwfts.ProbabilisticWeightedFTS,
database_file='experiments.db',
distributed='dispy', nodes=nodes)