How can I use the custom loss functions in scikit-learn? For example, instead of using the value of the mean squared, do I want to use the value of the mean squared multiplied by the true value of the sample?
I used the following code snippet:
def my_custom_loss_func (y_true, y_pred):
diff3 = (abs (y_true-y_pred)) * y_true
clf = RandomForestRegressor (criterion = my_custom_loss_func)
knn = clf.fit (feam, labm)
I got the following error: