SHARE
TWEET

Untitled

a guest Jul 18th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import numpy as np
  2. x = [1,2,3]
  3. y = [5,0,1]
  4.  
  5. def mae(target_y, predicted_y):
  6.     diff = np.array(target_y) - np.array(predicted_y) #diff = [-4, 2, 2]
  7.     absolute = np.absolute(diff) # absolute = [4, 2, 2]
  8.     summation = sum(absolute) # summation = 8
  9.     return summation / len(x) #2.6666666666666665
  10.    
  11. mae(x,y)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top