ageron / handson-ml

⛔️ DEPRECATED – See https://github.com/ageron/handson-ml3 instead.
Apache License 2.0
25.22k stars 12.91k forks source link

chapter 4: SGDRegressor(tol=-np.infty) is not accepted by the module #684

Open FranciscoFang opened 1 year ago

FranciscoFang commented 1 year ago

hi Aurelien, i've read the code of In[46], chapter4, but when i copied the code to jupyter and then it turned out to be an error like: "InvalidParameterError: The 'tol' parameter of SGDRegressor must be a float in the range [0.0, inf) or None. Got -inf instead. " i've already knew the SGDRegressor has a default value of 1e-03, but would you like to explain the error and what's your purpose of -np.infty? thank you very much for your patience. Francisco

patmull commented 1 year ago

I was able to do this with the tol set to None and _earlystopping=False:

sgd_reg = SGDRegressor(max_iter=1, tol=None, early_stopping=False, warm_start=True, penalty=None, learning_rate="constant", eta0=0.0005, n_iter_no_change=5000, random_state=42)