Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #!/usr/bin/python2.7
  2.  
  3. # Create a function that returns the mean absolute error percentage, given 2 lists in the following dictionary as input (35 pts)
  4. def MAPE(x1,x2):
  5.     AEP = []
  6.     for i in range(len(dataDict['x1'])):
  7.         AEP.append(float(dataDict[x1][i]-dataDict[x2][i])/(dataDict[x1][i]) * (100/15))
  8.     return (float(sum(AEP)/15))
  9.  
  10.  
  11. # Test the function by calling it with the following inputs (15 pts):
  12. dataDict = {'x1':[2,6,3,5,7,9,1,6,9,1,2,5,7,2,9], 'x2':[3,5,2,5,7,3,3,3,8,1,2,5,5,9,1]}
  13. print MAPE('x1','x2')
  14.  
  15. #may be wrong values
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement