sklearn 通过检查是否具有属性确定是否拟合过了
Posted wdmx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sklearn 通过检查是否具有属性确定是否拟合过了相关的知识,希望对你有一定的参考价值。
As model_selection.GridSearchCV uses set_params to apply parameter setting to estimators, it is essential that calling set_params has the same effect as setting parameters using the init method. The easiest and recommended way to accomplish this is to not do any parameter validation in init. All logic behind estimator parameters, like translating string arguments into functions, should be done in fit.
Also it is expected that parameters with trailing _ are not to be set inside the init method. All and only the public attributes set by fit have a trailing . As a result the existence of parameters with trailing is used to check if the estimator has been fitted.
以上是关于sklearn 通过检查是否具有属性确定是否拟合过了的主要内容,如果未能解决你的问题,请参考以下文章