scikit-learn.metrics import custom metric function
leeprinxin opened this issue · comments
leeprinxin commented
How do I import scikit-learn.metrics into a custom metrics function to use, for example, the following example :
from sklearn.metrics import mean_tweedie_deviance
def deviance(y_true, y_pred):
return mean_tweedie_deviance(y_true, y_pred)
clf = ak.StructuredDataRegressor(
overwrite=True,
max_trials=3,
metrics=['mae',deviance],
objective=keras_tuner.Objective('val_mae', direction='min'),
)
clf.fit(x_train, y_train, validation_data=(x_test,y_test), epochs=10)
Haifeng Jin commented
The example you give should work, right?
If you wang to set the deviance
as the objective, just do objective=keras_tuner.Objective('val_deviance', direction='min')
.