Plot MAE and MBE as a function of the height/pressure :param Ytrue: :param preds: :param height_ticks: must have same shape as Ytrue.shape[1] :param show: :return:
(Ytrue: np.ndarray, preds: np.ndarray, height_ticks=None,
xlabel='', ylabel='height', fill_between=True, show=True)
| 132 | |
| 133 | |
| 134 | def height_errors(Ytrue: np.ndarray, preds: np.ndarray, height_ticks=None, |
| 135 | xlabel='', ylabel='height', fill_between=True, show=True): |
| 136 | """ |
| 137 | Plot MAE and MBE as a function of the height/pressure |
| 138 | :param Ytrue: |
| 139 | :param preds: |
| 140 | :param height_ticks: must have same shape as Ytrue.shape[1] |
| 141 | :param show: |
| 142 | :return: |
| 143 | """ |
| 144 | n_samples, n_levels = Ytrue.shape |
| 145 | diff = Ytrue - preds |
| 146 | abs_diff = np.abs(diff) |
| 147 | levelwise_MBE = np.mean(diff, axis=0) |
| 148 | levelwise_MAE = np.mean(abs_diff, axis=0) |
| 149 | |
| 150 | levelwise_MBE_std = np.std(diff, axis=0) |
| 151 | levelwise_MAE_std = np.std(abs_diff, axis=0) |
| 152 | |
| 153 | # Plotting |
| 154 | plotting_kwargs = {'yticks': height_ticks, 'ylabel': ylabel, 'show': show, "fill_between": fill_between} |
| 155 | yaxis = np.arange(n_levels) |
| 156 | figMBE = height_plot(yaxis, levelwise_MBE, levelwise_MBE_std, xlabel=xlabel + ' MBE', **plotting_kwargs) |
| 157 | figMAE = height_plot(yaxis, levelwise_MAE, levelwise_MAE_std, xlabel=xlabel + ' MAE', **plotting_kwargs) |
| 158 | |
| 159 | if show: |
| 160 | plt.show() |
| 161 | return figMAE, figMBE |
| 162 | |
| 163 | |
| 164 | def height_plot(yaxis, line, std, yticks=None, ylabel=None, xlabel=None, show=False, fill_between=True): |
nothing calls this directly
no test coverage detected