What are the parameters for sklearn's score function?
It takes a feature matrix X_test
and the expected target values y_test
. Predictions for X_test
are compared with y_test
and either accuracy (for classifiers) or R² score (for regression estimators is returned.
This is stated very explicitly in the docstrings for score
methods. The one for classification reads
Returns the mean accuracy on the given test data and labels.
Parameters
----------
X : array-like, shape = (n_samples, n_features)
Test samples.
y : array-like, shape = (n_samples,)
True labels for X.
sample_weight : array-like, shape = [n_samples], optional
Sample weights.
Returns
-------
score : float
Mean accuracy of self.predict(X) wrt. y.
and the one for regression is similar.
Not sure that I understood your question correctly. Obviously, to compute some error or similarity most scoring functions receive an array of reference values (y_true
) and an array of values predicted by your model (y_score
) as main parameters, but may also receive some other parameters, specific for the metric. Scoring functions usually do not need X values.
I would suggest look into the source code of the scoring functions to understand how they work.
Here is a list of scoring functions in scikit-learn.
This is classifier dependent. Each classifier provides it's own scoring function.
Estimator score method: Estimators have a score method providing a default evaluation criterion for the problem they are designed to solve. This is not discussed on this page, but in each estimator’s documentation.
Apart from the documentation given to you in one of the answers, the only additional thing you can do is to read what kind of parameters your estimator provides. For example SVM classifier SVC has the following parameters score(X, y, sample_weight=None)