Search code examples
pythonmachine-learningscikit-learncross-validation

Additional fitting parameters for cross-validation


With scikit-learn, is there a way to pass additional parameters to the fit method of a classifier, when using cross_val_score? For instance, how would you specify the sample_weight or class_prior, for a MultinomialNB classifier:

scikit-learn's page about MultinomialNB


Solution

  • I did as suggested, and implemented the feature myself, which has been added to the 0.13 release, as fit_params:

    https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_val_score.html