Answers for "computing the error fucntion"

0

computing the error fucntion

# y = mx + b
# m is slope, b is y-intercept
def computeErrorForLineGivenPoints(b, m, points):
    totalError = 0
    for i in range(0, len(points)):
        totalError += (points[i].y - (m * points[i].x + b)) ** 2
    return totalError / float(len(points))
Posted by: Guest on July-13-2021

Browse Popular Code Answers by Language