Mercurial > hg > tvii
comparison tvii/error.py @ 70:351fc97bb996
add error computation + test functions
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 17 Dec 2017 13:22:44 -0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
69:0bb36ae047c3 | 70:351fc97bb996 |
---|---|
1 import numpy as np | |
2 | |
3 def error(function, x, y): | |
4 """ | |
5 computes true value and error and returns | |
6 them both as a 2-tuple | |
7 """ | |
8 | |
9 yhat = np.array([function(*val) for val in x]) | |
10 error = yhat - np.array(y) | |
11 | |
12 return (yhat, error) |