- [[cross-entropy loss]]: another strategy fits just one model - [[Python]] # Idea Fit multiple binary classification models to compare one class against the remaining class, and the class with the largest raw model output refers to the most likely class. This strategy is easy to implement, simple, and modular (vs. [[cross-entropy loss]]). It's also commonly used for [[support vector machines]]. One-vs-rest is the default behavior of [[scikit-learn]]'s logistic regression model. ```python logreg = LogisticRegression() # fit binary models logreg0.fit(X, y == 0) logreg1.fit(X, y == 1) logreg2.fit(X, y == 2) # compare model output logreg0.decision_function(X)[0] logreg1.decision_function(X)[0] logreg2.decision_function(X)[0] # sklearn's default behavior is one-vs-rest logreg.fit(X, y) # same result as above logreg.predict(X)[0] # same result as above ``` # References https://campus.datacamp.com/courses/linear-classifiers-in-python/logistic-regression-3?ex=9