elephaint / pgbm

Probabilistic Gradient Boosting Machines
Apache License 2.0
141 stars 20 forks source link

AttributeError: 'tuple' object has no attribute 'cpu' #15

Closed kiseno closed 2 years ago

kiseno commented 2 years ago

Hi I got the following error when using predict_dist, PGBMRegressor:

pgbm\pgbm.py:1618, in PGBMRegressor.predict_dist(self, X, n_forecasts, parallel, output_sample_statistics) 1615 X = checkarray(X) 1616 X = X.astype(np.float32) -> 1618 return self.learner.predict_dist(X, n_forecasts, parallel, output_sample_statistics).cpu().numpy()

AttributeError: 'tuple' object has no attribute 'cpu'

I have modified the code to address this error as follows:

1618    if output_sample_statistics == False:
1619        return self.learner_.predict_dist(X, n_forecasts, parallel, output_sample_statistics).cpu().numpy()
1620    elif output_sample_statistics == True:
 1621       return self.learner_.predict_dist(X, n_forecasts, parallel, output_sample_statistics)

This is a temporary fix, but I would appreciate it if you implement a fundamental fix.

Thank you.

elephaint commented 2 years ago

Ah, good point. I'll fix that, should be an issue fix.

elephaint commented 2 years ago

Fixed with 1.8.0