Comments (2)
Hi @liganega ,
Thanks for your feedback. Are you referring to the 2nd edition? Because there's already the following explanation in the 3rd edition:
This code actually made 45 predictions—one per pair of classes—and it selected the class that won the most duels. If you call the
decision_function()
method, you will see that it returns 10 scores per instance: one per class. Each class gets a score equal to the number of won duels plus or minus a small tweak (max ±0.33) to break ties, based on the classifier scores.
Indeed, under the hood, SVC
always uses OvO, there's no way to change that. The decision_function_shape
hyperparameter only affects the output of the decision_function()
method: if this hyperparameter is set to "ovr"
(which is the default), then it's still going to use OvO under the hood, but after that it will aggregate the 45 scores into 10 (one per class), while if you set this hyperparameter to "ovo"
, it will just return the 45 scores directly.
I think this is a confusing part of Scikit-Learn's API. Many people were confused when first reading the docs (myself included): it really looks like the class uses OvR by default, but it doesn't. It still trains 45 models, and it still makes 45 predictions, it's just the way these results are presented. More details here.
Hope this helps.
from handson-ml3.
The confusion comes from the number "10".
The number "10" in the sentence below does NOT correspond to the "10" binary classification models which would be trained if "OvR" method should really be applied. It's just the number of classes. And the 10 scores are aggregates of the 45 scores leared from 45 binary classification models based on the "OvO" method.
it returns 10 scores per instance: one per class
On the other hand, when the following hyperparameter is set, then 45 scores will be returned.
svm_clf.decision_function_shape = "ovo"
So IMHO, the confusion can easily arise.
Anyway, it is a subtle point, but well understood now. Thank you.
from handson-ml3.
Related Issues (20)
- [QUESTION] Clarification about likelihood and PDF HOT 1
- Chapter 16: Downloading Shakespeare model: I get exception downloading the shakespeare_model HOT 2
- [QUESTION] Chapter 14: Asking about GoogLeNet's archietcture
- [QUESTION] Chapter 2: Definition of `similarities` is subject to information leakage? HOT 2
- [QUESTION] Use of Normalization layer with keras_tuner
- [IDEA] Add instructions on how to build TF from source to make notebooks more accessible to those who have different GPUs HOT 1
- [QUESTION] "Installing and Starting TensorFlow Serving" in chapter 19 HOT 1
- [QUESTION] CHAPTER 2: Custom Transformer Issue with Joblib
- [QUESTION] Creating a Prediction Service on Vertex AI (chapter 19: training_and_deploying_at_scale.ipynb)
- [QUESTION] Figure 4-8
- Graphviz installation (Windows)
- [BUG] Chapter 10: number of output arguments of model.evaluate(...) for multiple outputs
- [BUG] Chapter 10: Syntax for saving/restoring keras model has changed
- [QUESTION]
- [BUG] Unable to run `docker compose` following the instructions: /opt/conda/envs/homl3/bin/jupyter directory missing HOT 2
- [invalid] CH11 - Faster Optimizations: incorrect use of momentum instead of just SGD
- [BUG] folder "datasets" is missing from the repo HOT 2
- [BUG] Chapter 15: pandas-implementation for 'resample' has changed
- [QUESTION] What is the correct form of Equation 4-13 in CH. 4 Logistic Regression?
- [BUG] Instead of underperforming it is written outperforming in 07_ensemble_learning_and_random_forests.ipynb HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handson-ml3.