view tvii/error.py @ 85:d705f6384e8b

i hate namespace conflicts
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Dec 2017 14:03:02 -0800
parents 351fc97bb996
children
line wrap: on
line source

import numpy as np

def error(function, x, y):
    """
    computes true value and error and returns
    them both as a 2-tuple
    """

    yhat = np.array([function(*val) for val in x])
    error = yhat - np.array(y)

    return (yhat, error)