Comments (2)
Hi, @ageron
Ok, I get it.
As for me, it's so unnatural to have TP in the right lower corner. I know, it's a common approach for confusion matrices to sort classes in ascending order, but for binary classification, IMHO, it's better to have "positive" at the beginning, the same order as in wiki
Thank you.
from handson-ml2.
Hi @kashevg,
Thanks for your feedback. I suppose you are referring to figure 3-2?
I'm not sure what you mean by "TP stays for False and TN stays for True class"? In the example, we are building a "5-detector", so "positive" means it's a 5, and "negative" means it's not a 5. So a TP is an image that is correctly labeled as positive. The figure does show 5s correctly labeled as 5s in the lower right cell, and that's the cell labeled as TP, so frankly I don't see the problem.
Regarding the confusion matrix's orientation, I'm not sure there is any official standard for the order of the columns and rows. I just did a quick informal search on Google Image for "confusion matrix" and among the first 11 confusion matrices for binary classifiers, 6 have the TP in the top left, and 5 in the lower right. That's almost 50%.
Moreover, Scikit-Learn itself puts the TP in the lower right, as the following code demonstrates:
>>> from sklearn.metrics import confusion_matrix
>>> # 1 TN 2 FP 3 FN 4 TP
>>> confusion_matrix([0, 0, 0, 1, 1, 1, 1, 1, 1, 1], # y_true
... [0, 1, 1, 0, 0, 0, 1, 1, 1, 1]) # y_pred
...
array([[1, 2],
[3, 4]])
I find this order quite natural, as it just follows the order of the classes (0=negative, 1=positive). This allows it to be consistent even when there are more classes.
I hope this helps!
from handson-ml2.
Related Issues (20)
- Where Can I find Appendix A? Is it in book or files? If files where? HOT 1
- [QUESTION] Chapter 14 error
- [BUG] [Chapter2] ValueError when calculating the correlations in corr_matrix = housing.corr() HOT 3
- [BUG] Chapter 4, Notebook: 04_training_linear_models.ipynb, Cell 47 HOT 4
- I get "TypeError: 'module' object is not subscriptable" for cm module HOT 2
- [BUG] 'my_mnist.data' HOT 1
- Chapter 10 neither attribute keras.wrapper nor keras.__version__ being found :/ HOT 1
- [QUESTION] Chapter 10 Exercise 10 Factor parameter HOT 1
- [QUESTION]What is the difference between predict_proba, decision_function and predict function and how to choose HOT 1
- [BUG] HOT 1
- [BUG]sgd_reg = SGDRegressor(max_iter=1, tol=-np.infty, warm_start=True, penalty=None, learning_rate="constant", eta0=0.0005, random_state=42)
- [BUG]X = iris["data"][:, 3:] # petal width y = (iris["target"] == 2).astype(np.int) # 1 if Iris virginica, else 0
- [BUG]09 unsupervised learning
- [QUESTION] Chapter 10 RandomizedSearchCV returned best model having worse performance. HOT 1
- [QUESTION] Chapter 2 StratfiedShuffleSplit
- Machine Learning
- [BUG] [Chapter 4]: Equation rendering issue in "exercise 12" solution in 04_training_linear_models.ipynb
- [QUESTION] About Cross-Validation in Chapter2 HOT 1
- [BUG] tools_pandas.ipynb - module 'numpy' has no attribute 'object' HOT 2
- [BUG] Chapter 12: Loading model is failed when using the custom regularisers, activation, etc 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-ml2.