AttributeError: 'str' object has no attribute 'decode' Getting this error while fitting the model. Does anyone why this?
from sklearn.linear_model import HuberRegressor
model = HuberRegressor()
model.fit(X_train,y_train)
error:
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2620/1972884986.py in <module>
1 from sklearn.linear_model import HuberRegressor
2 model = HuberRegressor()
----> 3 model.fit(X_train,y_train)
~\AppData\Roaming\Python\Python38\site-packages\sklearn\linear_model\_huber.py in fit(self, X, y, sample_weight)
294 " l-BFGS-b solver terminated with %s"
295 % opt_res.message)
--> 296 self.n_iter_ = _check_optimize_result("lbfgs", opt_res, self.max_iter)
297 self.scale_ = parameters[-1]
298 if self.fit_intercept:
~\AppData\Roaming\Python\Python38\site-packages\sklearn\utils\optimize.py in _check_optimize_result(solver, result, max_iter, extra_warning_msg)
241 " https://scikit-learn.org/stable/modules/"
242 "preprocessing.html"
--> 243 ).format(solver, result.status, result.message.decode("latin1"))
244 if extra_warning_msg is not None:
245 warning_msg = "\n" extra_warning_msg
AttributeError: 'str' object has no attribute 'decode'
CodePudding user response:
Welcome to SO! By looking at the latest version of scikit-learn here, this may be fixed by updating your scipy
and scikit-learn
.