Skip to content

Commit

Permalink
visualise evaluation metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
KaairaGupta committed Mar 8, 2020
1 parent b43a0a8 commit 4fb19b7
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 0 deletions.

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions dev/KaairaGupta/evaluation metric/visualise_evaluation_metric.py
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.

0 comments on commit 4fb19b7

Please sign in to comment.