A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scikit-learn.org/dev/developers/../modules/generated/sklearn.metrics.get_scorer.html below:

get_scorer — scikit-learn 1.8.dev0 documentation

get_scorer#
sklearn.metrics.get_scorer(scoring)[source]#

Get a scorer from string.

Read more in the User Guide. get_scorer_names can be used to retrieve the names of all available scorers.

Parameters:
scoringstr, callable or None

Scoring method as string. If callable it is returned as is. If None, returns None.

Returns:
scorercallable

The scorer.

Notes

When passed a string, this function always returns a copy of the scorer object. Calling get_scorer twice for the same scorer results in two separate scorer objects.

Examples

>>> import numpy as np
>>> from sklearn.dummy import DummyClassifier
>>> from sklearn.metrics import get_scorer
>>> X = np.reshape([0, 1, -1, -0.5, 2], (-1, 1))
>>> y = np.array([0, 1, 1, 0, 1])
>>> classifier = DummyClassifier(strategy="constant", constant=0).fit(X, y)
>>> accuracy = get_scorer("accuracy")
>>> accuracy(classifier, X, y)
0.4
Gallery examples#

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4