Machine Learning 9

Decision Trees(의사 결정 나무)와 Random Forests(랜덤 포레스트)

Decision Trees : 의사결정나무 의사결정나무 모델은 스무고개와 비슷하게 데이터를 feature 기준으로 순차적으로 분류한다. 전체적으로 나무를 뒤집어놓은 것과 같은 모양이며, 처음 노드를 root node, 중간을 intermediate node, 끝을 terminal node라 부른다. 큰 분산을 갖기 때문에 깊이가 매우 깊은 모델은 overfitting에 취약하다. Random Forest 의사결정나무의 단점을 보완한 랜덤포레스트 모델은 여러개의 의사결정나무 모델을 만들고, 데이터를 중복 가능하게 추출(bootstrap aggregating)해 임의로 각 모델에 넣는다. 그 이후 나온 모든 모델의 결과를 합산(앙상블)하여 예측을 하게 된다.

Coding/기타 2022.04.13

[Andrew Ng] Neural Network and Deep Learning : 4. Deep Neural Networks

Deep L-layer Neural network What is a deep neural network? 여러개의 hidden layer가 있는 NN을 Deep Neural network라고 한다. Notation 레이어 갯수 : L = 4 레이어 $l$에 있는 노드(유닛) 갯수 : $n^{[l]}$ 레이어 $l$에 있는 activations : $a^{[l]}$ $a^{[l]}=g^{[l]}(z^{[l]})$ $z^{[l]}$의 가중치 $w^{[l]}$ Forward Propagation in a Deep Network Forward Propagation $$z^{[l]}=w^{[l]}A^{[l-1]}+b^{[l]} \ A^{[l]}=g^{[l]}(z^{[l]})$$ Not vectorized$a^{[..

Coding/Coursera 2021.10.19

[2021.10.15] 딥러닝 강좌 3주차 끝.

Coursera의 Neural Networks and Deep Learning 3주차 강좌를 모두 마쳤다. 이번 주차에서는 hidden layer가 하나만 있는 모델을 사용해 딥러닝을 구현하는 내용이었다. 수업을 들으면서 어찌저찌 진도는 나갔지만, numpy의 shape(dimension)에 대한 정확한 이해와 딥러닝 학습 흐름에 대한 이해가 부족한 것 같다. 1. $a^{[i]}$ 는 i 번째 layer, $a_n$ 은 n번재 unit, $a^{[i](m)}$ 은 m번째 training example을 의미한다. 2. Vectorizing을 통해서 for-loop을 없앨 수 있는데, 같은 column은 같은 training example이, 같은 row에는 같은 unit이 위치하도록 한다. 3. NN을..

[Andrew Ng] Neural Network and Deep Learning : 3. One hidden layer Neural Network

Neural Networks Overview What is a Neural Network? Neural Network는 여러개의 hidden layer가 연결되어 있는 Logistic Regression과 비슷하다. Backward Propagation(calculation)을 통해 cost function의 각 변수에 대한 편미분 값을 구할 수 있다. Neural Network Representation $a^{[i]}$를 통해 i번째의 layer를 나타낸다. $a_n$을 통해 n번째의 unit을 나타낸다. $$a^{[0]} = X \ , \ a^{[1]} =\begin{bmatrix} a_1^{[1]} \ a_2^{[1]} \ \vdots \ a_n^{[1]} \end{bmatrix} \ , \ a^..

Coding/Coursera 2021.10.14

[Andrew Ng] Neural Network and Deep Learning : 2. Basics of Neural Network Programming (2)

Vectorization 벡터화를 통해 for-loops을 줄여 컴퓨터가 계산을 효율적으로 할 수 있게 할 수 있다. More vectorization examples Whenever possible, avoid explicit for-loops. $$u = Av \ u_i=\sum_i\sum_j A_{ij}v_j$$ non-vectorized u = np.zeros((n,1)) for i ... for j ... u[i] += A[i][j] * v[j] vectorized u = np.dot(A,v) Vectors and matrix valued functions ex. 모든 matrix elements에 exponential operation을 해야할 때 non-vectorized u = np.zer..

Coding/Coursera 2021.10.08

[Andrew Ng] Neural Network and Deep Learning : 2. Basics of Neural Network Programming (1)

Basics of Neural Network Programming Binary Classification 바이너리(0 또는 1)로 분류하는 것을 의미한다. 예를 들어 고양이의 이미지를 보고 고양이인지(1) 아닌지(2)를 판단해 라벨을 다는 것은 binary classification이다. Notation $n_x$ features : $x$, output $y$ $x \in \reals^{n_x} , \ y \in {0,1}$ m개의 training example : ${(x^{(1)},y^{(1)}),(x^{(2)},y^{(2)}),...,(x^{(m)},y^{(m)})}$ $$X = \begin{bmatrix} x^{(1)} \ x^{(2)} \ ... \ x^{(m)} \end{bmatrix} \ ..

Coding/Coursera 2021.10.06