Single number evaluation metric Use a single real number evaluation metric ML Project : Loop(Idea -> Code -> Experiment) needs evaluation There are lots of evaluation metric. ex) Precision , Recall for classifier Combine these evaluation metric to new one. ex) F1 score which algorithm is better? for example, use the Average Satisficing and Optimizing […]

# Category: Andrew NG

From coursera

## ML Strategy

ML strategy 데이터 모으기, 구조 개선하기 등 수많은 아이디어 중 가치 우선순위를 두는 전략이 필요 Orthogonalization 특정 결과를 위해 어떤 것을 튜닝할지 정하는 절차 -> orthogonalization(직교화) 여러 기능들에 대해 각각 method들이 있음 각 method들의 조정에 따라 나오는 결과가 독립되어있어야 조절하기 쉬움 만약 method들의 영향이 서로 중첩되면 조절하기 어려움 ex) tv 화면 조정 버튼 : 버튼 […]

## Hyperparameter tuning

Sort of hyperparameter : learning rate, very important #hidden units #mini-batch size #layers learning rate decay 등등.. 중요도에는 차이가 있음 How to choice Try random values : Don't use a grid 어떤 hyperparameter가 중요한지 알 수 없는 단계에서는, 격자에서 순서대로 선정하기 보다는, 아예 랜덤으로 선택하는 것이 낫다. Coarse to fine : 먼저 무작위로 선택하다가 성능이 […]

## Week 2 - Logistic Regression with a Neural Network mindset

Common steps for pre-processing a new dataset are: Figure out the dimensions and shapes of the problem (m_train, m_test, num_px, ...) Reshape the datasets such that each example is now a vector of size (num_px * num_px * 3, 1) "Standardize" the data You've implemented several functions that: Initialize (w,b) Optimize the loss iteratively to […]

## Week 2 - Python and Vectorization

Vectorization if non-verctorized:

1 2 3 4 |
Z = 0 for i in range(nx): z += W[i] * X[i] Z += b |

if vectorized:

1 |
Z = np.dot(W,X) + b |

it is much faster

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import numpy as np import time a = np.random.rand(1000000) b = np.random.rand(1000000) #check how much time was used tic = time.time() c = np.dot(a,b) toc = time.time() print("Vectorized version : " + str(1000*(toc-tic) + "ms") # 1.5ms c = 0 tic = time.time() for i in range(1000000): c += a[i]*b[i] toc = time.time() print("For loop version : " + str(1000*(toc-tic) + "ms") #474.2ms |

Vectorizing Logistic Regression b is real number, it will be automatically changed to vector to be added each element of matrix (python broadcasting)

1 |
Z = np.dot(W.T,X) + b |

A note on python/numpy vectors to simplify code and to avoid bug, don't use rank 1 array