Skip to content

Commit 1c6cf83

Browse files
committed
Fixed confusion matrix normalization issue.
1 parent 82c1d10 commit 1c6cf83

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

site/en/guide/core/logistic_regression_core.ipynb

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"metadata": {
67
"id": "FhGuhbZ6M5tl"
@@ -32,6 +33,7 @@
3233
]
3334
},
3435
{
36+
"attachments": {},
3537
"cell_type": "markdown",
3638
"metadata": {
3739
"id": "EIdT9iu_Z4Rb"
@@ -41,6 +43,7 @@
4143
]
4244
},
4345
{
46+
"attachments": {},
4447
"cell_type": "markdown",
4548
"metadata": {
4649
"id": "bBIlTPscrIT9"
@@ -63,6 +66,7 @@
6366
]
6467
},
6568
{
69+
"attachments": {},
6670
"cell_type": "markdown",
6771
"metadata": {
6872
"id": "DauaqJ7WhIhO"
@@ -74,6 +78,7 @@
7478
]
7579
},
7680
{
81+
"attachments": {},
7782
"cell_type": "markdown",
7883
"metadata": {
7984
"id": "nchsZfwEVtVs"
@@ -121,6 +126,7 @@
121126
]
122127
},
123128
{
129+
"attachments": {},
124130
"cell_type": "markdown",
125131
"metadata": {
126132
"id": "gFh9ne3FZ-On"
@@ -151,6 +157,7 @@
151157
]
152158
},
153159
{
160+
"attachments": {},
154161
"cell_type": "markdown",
155162
"metadata": {
156163
"id": "A3VR1aTP92nV"
@@ -182,6 +189,7 @@
182189
]
183190
},
184191
{
192+
"attachments": {},
185193
"cell_type": "markdown",
186194
"metadata": {
187195
"id": "0_Z1V6Dg-La_"
@@ -202,6 +210,7 @@
202210
]
203211
},
204212
{
213+
"attachments": {},
205214
"cell_type": "markdown",
206215
"metadata": {
207216
"id": "s4-Wn2jzVC1W"
@@ -268,6 +277,7 @@
268277
]
269278
},
270279
{
280+
"attachments": {},
271281
"cell_type": "markdown",
272282
"metadata": {
273283
"id": "3MWuJTKEDM-f"
@@ -296,6 +306,7 @@
296306
]
297307
},
298308
{
309+
"attachments": {},
299310
"cell_type": "markdown",
300311
"metadata": {
301312
"id": "J4ubs136WLNp"
@@ -316,6 +327,7 @@
316327
]
317328
},
318329
{
330+
"attachments": {},
319331
"cell_type": "markdown",
320332
"metadata": {
321333
"id": "5YOG5iKYKW_3"
@@ -338,6 +350,7 @@
338350
]
339351
},
340352
{
353+
"attachments": {},
341354
"cell_type": "markdown",
342355
"metadata": {
343356
"id": "_8pDCIFjMla8"
@@ -373,6 +386,7 @@
373386
]
374387
},
375388
{
389+
"attachments": {},
376390
"cell_type": "markdown",
377391
"metadata": {
378392
"id": "6o3CrycBXA2s"
@@ -430,6 +444,7 @@
430444
]
431445
},
432446
{
447+
"attachments": {},
433448
"cell_type": "markdown",
434449
"metadata": {
435450
"id": "VMXEhrZuKECV"
@@ -464,6 +479,7 @@
464479
]
465480
},
466481
{
482+
"attachments": {},
467483
"cell_type": "markdown",
468484
"metadata": {
469485
"id": "Q_mutLj0KNUb"
@@ -489,6 +505,7 @@
489505
]
490506
},
491507
{
508+
"attachments": {},
492509
"cell_type": "markdown",
493510
"metadata": {
494511
"id": "uTCndUecKZho"
@@ -528,6 +545,7 @@
528545
]
529546
},
530547
{
548+
"attachments": {},
531549
"cell_type": "markdown",
532550
"metadata": {
533551
"id": "eObQu9fDnXGL"
@@ -560,6 +578,7 @@
560578
]
561579
},
562580
{
581+
"attachments": {},
563582
"cell_type": "markdown",
564583
"metadata": {
565584
"id": "PribnwDHUksC"
@@ -590,6 +609,7 @@
590609
]
591610
},
592611
{
612+
"attachments": {},
593613
"cell_type": "markdown",
594614
"metadata": {
595615
"id": "J_0KHQ25_2dF"
@@ -616,6 +636,7 @@
616636
]
617637
},
618638
{
639+
"attachments": {},
619640
"cell_type": "markdown",
620641
"metadata": {
621642
"id": "sLiWZZPBSDip"
@@ -678,6 +699,7 @@
678699
]
679700
},
680701
{
702+
"attachments": {},
681703
"cell_type": "markdown",
682704
"metadata": {
683705
"id": "NoLiAg7fYft7"
@@ -745,6 +767,7 @@
745767
]
746768
},
747769
{
770+
"attachments": {},
748771
"cell_type": "markdown",
749772
"metadata": {
750773
"id": "yrj1TbOJasjA"
@@ -769,7 +792,7 @@
769792
" # Compute the confusion matrix and normalize it\n",
770793
" plt.figure(figsize=(10,10))\n",
771794
" confusion = sk_metrics.confusion_matrix(y.numpy(), y_classes.numpy())\n",
772-
" confusion_normalized = confusion / confusion.sum(axis=1)\n",
795+
" confusion_normalized = confusion / confusion.sum(axis=1, keepdims=True)\n",
773796
" axis_labels = range(2)\n",
774797
" ax = sns.heatmap(\n",
775798
" confusion_normalized, xticklabels=axis_labels, yticklabels=axis_labels,\n",
@@ -805,6 +828,7 @@
805828
]
806829
},
807830
{
831+
"attachments": {},
808832
"cell_type": "markdown",
809833
"metadata": {
810834
"id": "DlivxaDmTnGq"
@@ -816,6 +840,7 @@
816840
]
817841
},
818842
{
843+
"attachments": {},
819844
"cell_type": "markdown",
820845
"metadata": {
821846
"id": "7ADEN2rb4Nhj"
@@ -867,6 +892,7 @@
867892
]
868893
},
869894
{
895+
"attachments": {},
870896
"cell_type": "markdown",
871897
"metadata": {
872898
"id": "gtofGIBN_qFd"
@@ -902,6 +928,7 @@
902928
]
903929
},
904930
{
931+
"attachments": {},
905932
"cell_type": "markdown",
906933
"metadata": {
907934
"id": "vgGQuV-yqYZH"

0 commit comments

Comments
 (0)