sklearn.utils.validation
.has_fit_parameter¶
- sklearn.utils.validation.has_fit_parameter(estimator, parameter)[source]¶
Check whether the estimator’s fit method supports the given parameter.
- Parameters:
- estimatorobject
An estimator to inspect.
- parameterstr
The searched parameter.
- Returns:
- is_parameterbool
Whether the parameter was found to be a named parameter of the estimator’s fit method.
Examples
>>> from sklearn.svm import SVC >>> from sklearn.utils.validation import has_fit_parameter >>> has_fit_parameter(SVC(), "sample_weight") True