问题
What is correct way to implement MAPE under h2o framework?
I am interested to convert below function to h2o concept
def mape(a, b):
mask = a <> 0
return (np.fabs(a - b)/a)[mask].mean()
回答1:
import h2o
h2o.init()
df = h2o.create_frame(rows=100, cols=2, missing_fraction=0, integer_fraction=1, integer_range=5)
print(df)
def mape(a, b):
mask = a != 0
return (abs(a-b)/a)[mask].mean()
mape(df[0],df[1])
来源:https://stackoverflow.com/questions/43103022/mape-metric-at-h2o