You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Foundation viz section between Definition and Comparison, demonstrating
`plt.matshow` (continuous-magnitude story) and the Hinton diagram
(square area = magnitude, color = sign; zero = empty) on the existing
`mat_A`. Hinton helper inlined for Colab self-containment; matches
`60_linear_algebra_2/matshow.py`.
Pays forward to LA2 viz issues — subsequent notebooks can use Hinton
without re-introducing the convention.
Closes#371
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: 40_linear_algebra_1/45_matrix_and_vector_numpy.ipynb
+76-3Lines changed: 76 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,8 @@
3
3
{
4
4
"cell_type": "markdown",
5
5
"metadata": {
6
-
"id": "view-in-github",
7
-
"colab_type": "text"
6
+
"colab_type": "text",
7
+
"id": "view-in-github"
8
8
},
9
9
"source": [
10
10
"<a href=\"https://colab.research.google.com/github/kangwonlee/nmisp/blob/main/40_linear_algebra_1/45_matrix_and_vector_numpy.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n"
@@ -88,6 +88,79 @@
88
88
"\n"
89
89
]
90
90
},
91
+
{
92
+
"cell_type": "markdown",
93
+
"metadata": {},
94
+
"source": [
95
+
"## 행렬 시각화<br>Visualizing matrices\n"
96
+
]
97
+
},
98
+
{
99
+
"cell_type": "markdown",
100
+
"metadata": {},
101
+
"source": [
102
+
"행렬을 그림으로 살펴보는 두 가지 방법이 있다.<br>\n",
103
+
"There are two complementary ways to visualize a matrix.\n",
104
+
"\n",
105
+
"- **히트맵 (Heatmap)** : 각 칸의 값을 색으로 나타낸다. 회전 행렬과 같이 값이 연속적으로 변하는 행렬에 적합하다.<br>\n",
106
+
" **Heatmap** (`plt.matshow`) — colors each cell by its value. Best for matrices whose entries vary smoothly (rotations, geometric transforms).\n",
107
+
"\n",
108
+
"- **힌튼 도식 (Hinton diagram)** : 각 칸에 정사각형을 그리되, **정사각형의 넓이는 값의 크기에 비례**하고 **색은 부호를 나타낸다** (흰색 = 양수, 검은색 = 음수). 값이 0인 칸은 *문자 그대로 비어 있게* 보이므로, 행렬의 **구조나 희소성 (sparsity)** 이 한눈에 들어온다.<br>\n",
109
+
" **Hinton diagram** — draws a square in each cell whose **area is proportional to the magnitude** and whose **color shows the sign** (white = positive, black = negative). Zero entries are *literally empty*, so structure and sparsity become immediately legible.\n",
110
+
"\n",
111
+
"아래에서 같은 행렬 `mat_A` 를 두 방법으로 그려 비교해 본다.<br>\n",
112
+
"Below, the same `mat_A` is drawn both ways for comparison.\n"
113
+
]
114
+
},
115
+
{
116
+
"cell_type": "code",
117
+
"execution_count": null,
118
+
"metadata": {},
119
+
"outputs": [],
120
+
"source": [
121
+
"# Hinton diagram helper\n",
122
+
"# (also available at 60_linear_algebra_2/matshow.py)\n",
0 commit comments