Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python2.7
- # Create a function that returns the mean absolute error percentage, given 2 lists in the following dictionary as input (35 pts)
- def MAPE(x1,x2):
- AEP = []
- for i in range(len(dataDict['x1'])):
- AEP.append(float(dataDict[x1][i]-dataDict[x2][i])/(dataDict[x1][i]) * (100/15))
- return (float(sum(AEP)/15))
- # Test the function by calling it with the following inputs (15 pts):
- 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]}
- print MAPE('x1','x2')
- #may be wrong values
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement