Evaluate a score by cross-validation. Parameters ---------- estimator : instance of sklearn.base.BaseEstimator The object to use to fit the data. Must implement the 'fit' method. X : array-like, shape (n_samples, n_dimensional_features,) The data to fit. Can
(
estimator,
X,
y=None,
groups=None,
scoring=None,
cv=None,
n_jobs=None,
verbose=None,
fit_params=None,
pre_dispatch="2*n_jobs",
)
| 793 | |
| 794 | @verbose |
| 795 | def cross_val_multiscore( |
| 796 | estimator, |
| 797 | X, |
| 798 | y=None, |
| 799 | groups=None, |
| 800 | scoring=None, |
| 801 | cv=None, |
| 802 | n_jobs=None, |
| 803 | verbose=None, |
| 804 | fit_params=None, |
| 805 | pre_dispatch="2*n_jobs", |
| 806 | ): |
| 807 | """Evaluate a score by cross-validation. |
| 808 | |
| 809 | Parameters |
| 810 | ---------- |
| 811 | estimator : instance of sklearn.base.BaseEstimator |
| 812 | The object to use to fit the data. |
| 813 | Must implement the 'fit' method. |
| 814 | X : array-like, shape (n_samples, n_dimensional_features,) |
| 815 | The data to fit. Can be, for example a list, or an array at least 2d. |
| 816 | y : array-like, shape (n_samples, n_targets,) |
| 817 | The target variable to try to predict in the case of |
| 818 | supervised learning. |
| 819 | groups : array-like, with shape (n_samples,) |
| 820 | Group labels for the samples used while splitting the dataset into |
| 821 | train/test set. |
| 822 | scoring : str, callable | None |
| 823 | A string (see model evaluation documentation) or |
| 824 | a scorer callable object / function with signature |
| 825 | ``scorer(estimator, X, y)``. |
| 826 | Note that when using an estimator which inherently returns |
| 827 | multidimensional output - in particular, SlidingEstimator |
| 828 | or GeneralizingEstimator - you should set the scorer |
| 829 | there, not here. |
| 830 | cv : int, cross-validation generator | iterable |
| 831 | Determines the cross-validation splitting strategy. |
| 832 | Possible inputs for cv are: |
| 833 | |
| 834 | - None, to use the default 5-fold cross validation, |
| 835 | - integer, to specify the number of folds in a ``(Stratified)KFold``, |
| 836 | - An object to be used as a cross-validation generator. |
| 837 | - An iterable yielding train, test splits. |
| 838 | |
| 839 | For integer/None inputs, if the estimator is a classifier and ``y`` is |
| 840 | either binary or multiclass, |
| 841 | :class:`sklearn.model_selection.StratifiedKFold` is used. In all |
| 842 | other cases, :class:`sklearn.model_selection.KFold` is used. |
| 843 | %(n_jobs)s |
| 844 | %(verbose)s |
| 845 | fit_params : dict, optional |
| 846 | Parameters to pass to the fit method of the estimator. |
| 847 | pre_dispatch : int, or str, optional |
| 848 | Controls the number of jobs that get dispatched during parallel |
| 849 | execution. Reducing this number can be useful to avoid an |
| 850 | explosion of memory consumption when more jobs get dispatched |
| 851 | than CPUs can process. This parameter can be: |
| 852 |