Toggle Menu
Prev Up Next

scikit-learn 1.3.2
Other versions

Please cite us if you use the software.

# `sklearn.utils.validation`.has_fit_parameter

sklearn.utils.validation.has_fit_parameter(estimator, parameter)

  Check whether the estimator’s fit method supports the given parameter.

  Parameters:
    estimator object

      An estimator to inspect.

    parameter str

      The searched parameter.

  Returns:
    is_parameter bool

      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