MCPcopy
hub / github.com/scikit-learn/scikit-learn / _fit_binary

Function _fit_binary

sklearn/multiclass.py:81–97  ·  view source on GitHub ↗

Fit a single binary estimator.

(estimator, X, y, fit_params, classes=None)

Source from the content-addressed store, hash-verified

79
80
81def _fit_binary(estimator, X, y, fit_params, classes=None):
82 """Fit a single binary estimator."""
83 unique_y = np.unique(y)
84 if len(unique_y) == 1:
85 if classes is not None:
86 if y[0] == -1:
87 c = 0
88 else:
89 c = y[0]
90 warnings.warn(
91 "Label %s is present in all training examples." % str(classes[c])
92 )
93 estimator = _ConstantPredictor().fit(X, unique_y)
94 else:
95 estimator = clone(estimator)
96 estimator.fit(X, y, **fit_params)
97 return estimator
98
99
100def _partial_fit_binary(estimator, X, y, partial_fit_params):

Callers 1

_fit_ovo_binaryFunction · 0.85

Calls 3

cloneFunction · 0.90
_ConstantPredictorClass · 0.85
fitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…