AI ML
-
Label Encoding + One Hot EncodingAI ML/ML 2021. 1. 21. 00:03
Encoding¶OneHotEncoding¶sklearn¶ 변환하기 위해 모든 문자열 값이 숫자형 값으로 먼저 변환 입력값으로 2차원 데이터 Pandas¶ get_dummies : 문자열만 Encoding 숫자를 astype(str)으로 바꾼 뒤 In [3]: from sklearn.preprocessing import OneHotEncoder from sklearn.preprocessing import LabelEncoder import numpy as np import pandas as pd In [2]: items = ['폰', '스마트폰', '갤럭시', '아이폰', '애플', '삼성', '애플'] ..
-
Cross ValidationAI ML/ML 2021. 1. 19. 23:45
Cross Validation¶ Stratified K Fold¶ Stratified K Fold : 불균형한 분포도를 가진 Label 데이터 집합을 위한 KFold 방식 stratifiedkfold = StratifiedKFold(n_splits=4,random_state=0,shuffle=False) stratifiedkfold.split(X,y): y값을 추가 인자로 받습니다. In [1]: from sklearn.model_selection import StratifiedKFold skf = StratifiedKFold(n_splits=3) In [2]: skf Out[2]: StratifiedKFold(n_splits=3, random_state=None, shuffle=False) TimeSe..
-
How to deal with missing dataAI ML/ML 2020. 6. 24. 21:57
MCAR - Missing Completely at Random - 관측된 변수 X와 다른 부분 missing value Y간의 상관관계 전혀 없다. MAR - Missing at Random - Partly missing Variable Y 가 다른 완전한 관측지와는 연관이 있고, Y 변수 자체에는 연관이 없는 것. MNAR - Missing not at Random - 결측치가 변수 Y와 직접 연관된것 - for example, people who are not rich don't want to answer the question about how much money do you earn? 결측 데이터의 원인 + 각 원인에 따른 처리 방법 1. 데이터의 몇%가 결측인가? 2. 결측 데이터가 특정한 몇..
-
딥러닝에서 Learning Rate를 최적화하는 방법AI ML/ML 2020. 6. 23. 22:12
https://towardsdatascience.com/learning-rate-a6e7b84f1658 작은 learning rate는 뉴럴넷을 느리고 조심스럽게 adjust, Local Minima 국소 최적치에 빠져 최적화된 W값을 찾기도 전에 학습이 끝날 수 있음 큰 Learning rate는 impetuous 맹렬하다. 빠르게 adjust but, overshooting의 위험성 딥러닝에서 뉴럴넷을 빠르고 정확하게를 동시에 만족시키는 Learning Rate 찾기가 과제 In general, lr = 0.01 학습률 스케쥴러(Learning Rate Scheduler) # 학습률 스케줄러는 옵티마이져를 통해 적용된다. optimizer = torch.optim.SGD(model.parameters..