Skip to content Skip to sidebar Skip to footer

MAPE Metric At H2O

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 -

Solution 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])

Post a Comment for "MAPE Metric At H2O"