3. 다원 일차 연립 방정식

1) Well-Determined Linear Systems

  • unknown = constraint
  • 해가 존재한다.

2) Under-determined Linear Systems

  • unknown > constraint
  • 해가 무수히 많다.

3) Over-determined Linear Systems => Machine Learning

  • unknown < constraint
  • 해가 없다.

  • 머신러닝은 Over-determined 된 Linear Systems에서 사용된다.

<실습>

실습 1

import numpy as np
theta = 30/180*np.pi
R = np.matrix([[np.cos(theta), -np.sin(theta)],
               [np.sin(theta), np.cos(theta)]])
x = np.matrix([[1],[0]])
y = R*x
print(y)


[[0.8660254]
 [0.5      ]]

 

실습 2

P = np.matrix([[1,0],
               [0,0]])
x = np.matrix([[1],
               [1]])
y = P*x
print(y)
D,V = np.linalg.eig(P)
print(D)
print(V)


[[1]
 [0]]
[1. 0.]
[[1. 0.]
 [0. 1.]]

 

실습 3

X = np.matrix([[1],[1]])
Y = np.matrix([[2],[0]])
X.T*Y
Y.T*Y
omega = (X.T*Y)/(Y.T*Y)
omega = float(omega)
W = omega*Y
print(W)


[[1.]
 [0.]]

 

실습 4

A = np.matrix([[1,0],[0,1],[0,0]])
B = np.matrix([[1],[1],[1]])
X = (A.T*A).I*A.T*B
print(X)
Bstar = A*X
print(Bstar)


[[1.]
 [1.]]
[[1.]
 [1.]
 [0.]]
728x90

+ Recent posts