You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
321 B
12 lines
321 B
2 years ago
|
def validate(y_hat):
|
||
|
y = [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1]
|
||
|
|
||
|
import math
|
||
|
errs = [yy - int(yyh) for yy, yyh in zip(y, y_hat.split(' '))]
|
||
|
err = 0
|
||
|
for e in errs:
|
||
|
err += abs(e)
|
||
|
|
||
|
err = err/len(y)
|
||
|
return err
|