python - What are the parameters for sklearn's score function? -


i looked @ bunch of sklearn tutorials, similar in scored goodness of fit by:

clf.fit(x_train, y_train) clf.score(x_test, y_test) 

and it'll spit out:

0.92345... 

or other score.

i curious parameters of clf.score function or how scores model. looked on internet, can't seem find documentation it. know?

it takes feature matrix x_test , expected target values y_test. predictions x_test compared y_test , either accuracy (for classifiers) or r² score (for regression estimators returned.

this stated explicitly in docstrings score methods. 1 classification reads

returns mean accuracy on given test data , labels.  parameters ---------- x : array-like, shape = (n_samples, n_features)     test samples.  y : array-like, shape = (n_samples,)     true labels x.  sample_weight : array-like, shape = [n_samples], optional     sample weights.  returns ------- score : float     mean accuracy of self.predict(x) wrt. y. 

and 1 regression similar.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -