成功解决FutureWarning: max_iter and tol parameters have been added

简介: 成功解决FutureWarning: max_iter and tol parameters have been added

解决问题


FutureWarning: max_iter and tol parameters have been added in <class 'sklearn.linear_model.stochastic_gradient.SGDClassifier'> in 0.19. If both are left unset, they default to max_iter=5 and tol=None. If tol is not None, max_iter defaults to max_iter=1000. From 0.21, default max_iter will be 1000, and default tol will be 1e-3.

 "and default tol will be 1e-3." % type(self), FutureWarning)


类似的问题


linear_model\stochastic_gradient.py:128: FutureWarning: max_iter and tol parameters have been added in <class 'sklearn.linear_model.stochastic_gradient.SGDRegressor'> in 0.19. If both are left unset, they default to max_iter=5 and tol=None. If tol is not None, max_iter defaults to max_iter=1000. From 0.21, default max_iter will be 1000, and default tol will be 1e-3.

 "and default tol will be 1e-3." % type(self), FutureWarning)



解决思路


未来警告:在0.19中的<class'sklearn.linear_model.randomatic_gradient.sgdclassifier'>中添加了max_iter和tol参数。如果两个都未设置,则默认为max_iter=5,tol=none。如果tol不是none,max-iter默认为max-iter=1000。从0.21开始,默认的最大值为1000,默认的公差为1e-3。“默认TOL将为1E-3。





解决方法


此信息提示为警告,而不是error,即使不处理也不会影响代码编程的运行。如果想要去掉,可以更新库至最新版本!

然后根据提示修改使用方法!

stochastic_gradient模块已经被重构,在未来的版本中默认参数有所改变!

然后使用最新版本stochastic_gradient方法,并要知道默认参数已经随着版本升级而改变了。



 


相关文章
RuntimeError: Given groups=1, weight of size 64 128 1 7, expected input[16,
RuntimeError: Given groups=1, weight of size 64 128 1 7, expected input[16,
3005 0
|
6月前
|
数据处理 开发者 Python
【Python】已解决:ValueError: Length mismatch: Expected axis has 5 elements, new values have 4 elements
【Python】已解决:ValueError: Length mismatch: Expected axis has 5 elements, new values have 4 elements
452 9
|
8月前
|
Linux Windows
【已解决】ValueError: num_samples should be a positive integer value, but got num_samples=0
【已解决】ValueError: num_samples should be a positive integer value, but got num_samples=0
成功解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]
成功解决ValueError: Found input variables with inconsistent numbers of samples: [86, 891]
|
TensorFlow 算法框架/工具
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
293 0
解决TypeError: tf__update_state() got an unexpected keyword argument ‘sample_weight‘
params argument given to the optimizer should be an iterable
params argument given to the optimizer should be an iterable
198 0
params argument given to the optimizer should be an iterable
|
JSON 数据格式
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
551 0
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
|
Python
解决办法:RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96
解决办法:RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96
582 0
成功解决ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C h
成功解决ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C h
成功解决ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C h
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be