- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到警告
File "[...]\lib\threading.py", line 890, in _bootstrap
self._bootstrap_inner()
File "[...]\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 216, in run
self._on_run()
File "C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_console_commands.py", line 30, in _on_run
values.append(pydevd_thrift.var_to_struct(var_obj, name, evaluate_full_value=True))
File "C:\Program Files\JetBrains\PyCharm 2019.1.3\plugins\python\helpers\pydev\_pydevd_bundle\pydevd_thrift.py", line 305, in var_to_struct
value = format % v
File "[...]\lib\site-packages\sklearn\base.py", line 263, in __repr__
repr_ = pp.pformat(self)
File "[...]\lib\pprint.py", line 153, in pformat
self._format(object, sio, 0, 0, {}, 0)
File "[...]\lib\pprint.py", line 170, in _format
rep = self._repr(object, context, level)
File "[...]\lib\pprint.py", line 404, in _repr
repr, readable, recursive = self.format(object, context.copy(),
File "[...]\lib\site-packages\sklearn\utils\_pprint.py", line 169, in format
return _safe_repr(object, context, maxlevels, level,
File "[...]\lib\site-packages\sklearn\utils\_pprint.py", line 415, in _safe_repr
params = object.get_params(deep=False)
File "[...]\lib\site-packages\sklearn\base.py", line 193, in get_params
warnings.warn('From version 0.24, get_params will raise an '
File "[...]\lib\warnings.py", line 109, in _showwarnmsg
sw(msg.message, msg.category, msg.filename, msg.lineno,
File "<input>", line 59, in warn_with_traceback
[...]\lib\site-packages\sklearn\base.py:193: FutureWarning: From version 0.24, get_params will raise an AttributeError if a parameter cannot be retrieved as an instance attribute. Previously it would return None.
warnings.warn('From version 0.24, get_params will raise an '
尝试使用 sklearn 时。我不知道如何找出如何解决这个问题。显然,这对你来说是很少的信息,但我什至不知道从哪里开始追踪这个问题。
最佳答案
我想,我能够靠运气找到答案。如 scikit-learn 的 documentation 中所述,初始化必须看起来像
def __init__(self, param1=1, param2=2):
self.param1 = param1
self.param2 = param2
我犯的错误是写了类似的东西
def __init__(self, param1=1, param2=2):
self.param1 = param1
self.param2_ = param2
注意下划线。必须避免这种情况,因为它会干扰方法
set_params
和
get_params
.的确,我的警告源于后者。
Attributes that have been estimated from the data must always have a name ending with trailing underscore, for example the coefficients of some regression estimator would be stored in a coef_ attribute after fit has been called.
The estimated attributes are expected to be overridden when you call fit a second time.
关于python - FutureWarning get_params 来自 scikit-learn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63251437/
我正在尝试定义一个符合 Sklearn 估算器条件的类,例如 class MyEstimator(): def __init__(self,verbose=False): se
我收到警告 File "[...]\lib\threading.py", line 890, in _bootstrap self._bootstrap_inner() File "[...]\l
我的模型已保存,我正在尝试部署模型,但收到错误消息 AttributeError:“super”对象没有属性“get_params”。我无法在我的代码中找到任何错误。任何人都可以帮助解决这个问题。在此
我试图继承 BaseEstimator 和 MetaEstimatorMixin 来为 base_estimator 创建包装,但我遇到了问题。我试图遵循存储库中的 base_ensemble 代码,
我正在使用 jquery $.ajax 解析生成的 json,但有一个选项我不明白。我在一些例子中看到了它,并试图在 jquery.com 上寻找它,但仍然不确定: 这个选项是: data: { ge
我在 scikit-learn 中有一个管道,它使用我定义的自定义转换器,如下所示: class MyPipelineTransformer(TransformerMixin): 定义函数 __ini
我正在尝试将 scikit-learn 包与 python-3.4 一起使用来进行网格搜索, from sklearn.feature_extraction.text import TfidfVect
我正在使用网格搜索来获得最合适的 k=['rbf', 'linear','poly','sigmoid'] c= [1,5,10,20,30,50,80,100] g=[1e-7,1e-6,1e-5,
我是一名优秀的程序员,十分优秀!