plotting
Plotting functions often needed. Not extremely well polished, rather a tool for quick visualization.
plot_predicted_ts(ts_true, ts_pred, start=None, end=None, ax=None, title='', figsize=(6, 2), legend=True)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts_true
|
ndarray | list | Series
|
np.ndarray, List, pd.Series Target time series. |
required |
ts_pred
|
ndarray | list | Series
|
np.ndarray, List, pd.Series Predicted time series. |
required |
start
|
int | None
|
int, optional Plot will be timeseries[start: end]. |
None
|
end
|
int | None
|
int, optional Plot will be timeseries[start: end]. |
None
|
ax
|
Axes | None
|
plt.Axes, optional Axes to plot on. If None, a new figure is created. Default None |
None
|
title
|
str
|
str,optional Plot title. |
''
|
figsize
|
tuple
|
tuple Figure size. Default (6, 2). |
(6, 2)
|
legend
|
bool
|
bool If True, legend is added ("target", "predicted"). |
True
|
Returns:
Name | Type | Description |
---|---|---|
ax |
matplotlib Axes Returns the Axes object with the plot drawn onto it. |
Source code in echoes/plotting/_core.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
plot_reservoir_activity(esn, neurons, train=False, pred=True, start=None, end=None, figsize=(15, 9), **kwargs)
¶
Plot the activity, ie time series of states, of the reservoir neurons.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
esn
|
ESNRegressor | ESNGenerator
|
ESNPredictive, ESNGenerative Instances of ESN after fitting and/or prediction. |
required |
neurons
|
ndarray | list
|
np.ndarray or List List of reservoir neurons indices whose time series will be plotted. |
required |
train
|
bool
|
bool, optional If True, the time series during training will be plotted. Either train or pred must be True, but only one of the two. |
False
|
pred
|
bool
|
bool, optional If True, the time series during prediction will be plotted. Either train or pred must be True, but only one of the two. |
True
|
start
|
int | None
|
int, optional Plot will be timeseries[start: end]. |
None
|
end
|
int | None
|
int, optional Plot will be timeseries[start: end]. |
None
|
suptitle
|
str, optional Plot suptitle. |
required | |
figsize
|
tuple
|
tuple Figure size. Default (15, 10). |
(15, 9)
|
kwargs
|
dict Plotting kwargs passed to plt.plot |
{}
|
Returns:
Name | Type | Description |
---|---|---|
fig |
plt.figure Figure object for fine tuning. |
Source code in echoes/plotting/_core.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
set_mystyle()
¶
Set context and a couple of defaults for nicer plots.
Source code in echoes/plotting/_core.py
16 17 18 19 20 21 22 23 |
|
Plotting functions related to the Memory Capacity task.
plot_forgetting_curve(lags, forgetting_curve, ax=None, **kwargs)
¶
Plot forgetting curve, ie, memory capacity (MC) vs lag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lags
|
list | ndarray
|
np.ndarray or List Sequence of lags used in the memory capacity task. |
required |
forgetting_curve
|
ndarray
|
np.ndarray Sequence of results from the memory task. |
required |
ax
|
Axes
|
plt.Axes, optional If given plot will use this axes. |
None
|
kwargs
|
mapping, optional Plotting args passed to ax.plot. |
{}
|
Source code in echoes/plotting/_memory_capacity.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
plot_mc_predicted_ts(lags, outputs_true, outputs_pred, start=None, end=None)
¶
Plot true and predicted time series coming from memory capacity task for all lags.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lags
|
list | ndarray
|
np.ndarray or List Delays to be evaluated (memory capacity). For example: np.arange(1, 31, 5). |
required |
ouputs_true
|
np.ndarray of shape (len(ts), len(n_lags)) Target time series used for testing the model. |
required | |
ouputs_pred
|
np.ndarray of shape (len(ts), len(n_lags)) Predicted time series resulting from testing the model. |
required | |
start/end
|
int, optional Plot will we timeseries[start: end], to exclude transient. |
required |
Source code in echoes/plotting/_memory_capacity.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|