lazypredict
lazypredict copied to clipboard
Custom metric
Hi there, Thank you for this code. It would be nice if you could provide an example of how to use custom metrics.
I second this. All examples use custom_metrics=None
. I tried assigning a series of strings looking at the names in the source code but no luck.
I had the same problem, here is how I managed to solve it, it is important to know the y_true format to solve the problem(type(y)=type(y_true)).
hope this will help someone. And you can change some code here, to see what is your y_true https://github.com/shankarpandala/lazypredict/blob/master/lazypredict/Supervised.py#:~:text=time.time()%20%2D%20start)-,if%20self.custom_metric%3A,CUSTOM_METRIC.append(custom_metric),-if%20self.verbose .
I had the same problem. The custom metrics are sklearn metrics. you can solve it by importing the metrics you need from sklear.metrics and pass them as custom_metrics. Here's an example:
from sklearn.metrics import mean_absolute_error
reg = LazyRegressor(predictions=True, custom_metric = mean_absolute_error)
models, predictions = reg.fit(X_train, X_test, y_train, y_test)