006-lec-001. multinomial classification(multiple classes like A,B,C)
# @
# Multinomial classification: label is over 2 like A,B,C
# $$$x_{1}$$$(hour) $$$x_{2}$$$(attendance) y(grade)
# 10 5 A
# 9 5 A
# 3 2 B
# 2 4 B
# 11 1 C
# img 4f189664-2ca0-3d6d-8646-bb176b7ed5c4
# XW=H(X)
# This is for classifier A
$$$\begin{bmatrix} w_{A1} & w_{A2} & w_{A3} \end{bmatrix} \cdot \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \end{bmatrix}=\begin{bmatrix} w_{A1}x_{1} + w_{A2}x_{2} + w_{A3}x_{3} \end{bmatrix}$$$
# This is for classifier B
$$$\begin{bmatrix} w_{B1} & w_{B2} & w_{B3} \end{bmatrix} \cdot \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \end{bmatrix}=\begin{bmatrix} w_{B1}x_{1} + w_{B2}x_{2} + w_{B3}x_{3} \end{bmatrix}$$$
# This is for classifier C
$$$\begin{bmatrix} w_{C1} & w_{C2} & w_{C3} \end{bmatrix} \cdot \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \end{bmatrix}=\begin{bmatrix} w_{C1}x_{1} + w_{C2}x_{2} + w_{C3}x_{3} \end{bmatrix}$$$
# You try to merge above classification
$$$\begin{bmatrix} w_{A1} & w_{A2} & w_{A3} \\ w_{B1} & w_{B2} & w_{B3} \\ w_{C1} & w_{C2} & w_{C3} \end{bmatrix} \cdot \begin{bmatrix} x_{1} \\ x_{2} \\ x_{3} \end{bmatrix}=\begin{bmatrix} w_{A1}x_{1} + w_{A2}x_{2} + w_{A3}x_{3} \\ w_{B1}x_{1} + w_{B2}x_{2} + w_{B3}x_{3} \\ w_{C1}x_{1} + w_{C2}x_{2} + w_{C3}x_{3} \end{bmatrix}$$$
$$$\begin{bmatrix} w_{A1}x_{1} + w_{A2}x_{2} + w_{A3}x_{3} \\ w_{B1}x_{1} + w_{B2}x_{2} + w_{B3}x_{3} \\ w_{C1}x_{1} + w_{C2}x_{2} + w_{C3}x_{3} \end{bmatrix}=\begin{bmatrix} \hat{Y}_{A} \\ \hat{Y}_{B} \\ \hat{Y}_{C} \end{bmatrix}$$$
$$$\hat{Y}_{A}=H_{A}(X)=w_{A1}x_{1} + w_{A2}x_{2} + w_{A3}x_{3}$$$
$$$\hat{Y}_{B}=H_{B}(X)=w_{B1}x_{1} + w_{B2}x_{2} + w_{B3}x_{3}$$$
$$$\hat{Y}_{C}=H_{C}(X)=w_{C1}x_{1} + w_{C2}x_{2} + w_{C3}x_{3}$$$
# @
# multiple variable+one label
# For example, I want to predict score of final exam from 3 scores
# x1(quiz 1) x2(quiz 2) x3(midterm 1) Y(score of final exam)
# 73 80 75 152
# 93 88 93 185
# 89 91 90 180
# 96 98 100 196
# 73 66 70 142
# Multinomial classification
# x1(hour) x2(attendance) y(grade)
# 10 5 A
# 9 5 A
# 3 2 B
# 2 4 B
# 11 1 C
# You need 3 hypothesis functions
# You make 3 hypothesis functions to predict
# and then they create 3 values separately
# You can choose hightest one