Closed hengzhe-zhang closed 1 year ago
Hi,
Thanks for reporting this bug. The models can indeed predict NaN values, leading to that error.
I think the problem is here at line 438: https://github.com/hengzhe-zhang/SR-Forest/blob/master/sr_forest/operon_forest.py#L438
mse = mean_squared_error(y, y_pred * scale + offset)
This code should fix it:
try:
mse = mean_squared_error(y, y_pred * scale + offset)
except ValueError:
mse = sys.maxsize # or whatever you find appropriate
I got an error when running Operon multiple times.
The error information is as follows:
I guess the reason might be some SR models predict nan values, and thus lead to scikit-learn raising such an error. However, I don't know how to fix this problem. Can you help me to deal with this problem? Thanks.
Here is a reproducible example.