-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b43a0a8
commit 4fb19b7
Showing
6 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
113 changes: 113 additions & 0 deletions
113
dev/KaairaGupta/evaluation metric/example_visualise_evaluation_metric.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
dev/KaairaGupta/evaluation metric/visualise_evaluation_metric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
def visualise_evaluation_metric(table): | ||
|
||
""" | ||
This function plot a metric against the values of some parameter with repeated runs to assess variability. | ||
Input: Table (numpy array) with columns (x, y1, y2, ..., yk), i.e. multiple y values for each x. | ||
Output: Plots showing the average y value vs x with the spread of the y-values represented by min-max and standard-deviation of y. | ||
""" | ||
|
||
x = table[0] | ||
|
||
_mean = np.empty(len(x)) | ||
_min = np.empty(len(x)) | ||
_max = np.empty(len(x)) | ||
_std = np.empty(len(x)) | ||
|
||
table = table.transpose() | ||
|
||
for i in range(len(table)): | ||
r = table[i] | ||
|
||
_mean[i] = np.mean(r[1:]) | ||
_min[i] = np.min(r[1:]) | ||
_max[i] = np.max(r[1:]) | ||
_std[i] = np.std(r[1:]) | ||
|
||
plt.plot(x, _mean, label='Mean', linewidth=2, color='g') | ||
plt.plot(x, _min, label='Min',linewidth=1, color='y') | ||
plt.plot(x, _max, label='Max',linewidth=1, color='r') | ||
plt.fill_between(x, _mean-(_std/2), _mean+(_std/2), alpha=0.3, label='Standard Deviation') | ||
|
||
plt.legend() | ||
plt.show() |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.