[AI]/Machine Learning(13)
-
[Machine Learning] - Mindmap
mm.tt/1804764367?t=2yEYWerNQZ Machine Learning taeyoon noh님이 공유하신 마인드맵 www.mindmeister.com
2021.03.07 -
Linear Models(1) - Simple Regression
Learned Stuff Key Points Prediction Method By experience By statistical parameters (min, max, mean, median) By predictive model (best fit line) Linear Regression 개념 OLS (Ordinary Least Squares) New Stuff [Linear Regression] # train_data, test_data 라는 dataframe이 있다고 가정 from sklearn.linear_model import LinearRegression # 모델 학습시킬 데이터 구분하기 model = LinearRegression() feature = ['a'] # 'a' feature 라고 ..
2021.03.07 -
Linear Models(2) - Multiple Regression
Learned Stuff Key Points split train data / test data multiple regression evaluation metrics $MSE$ (Mean Squared Error) $MAE$ (Mean Absolute Error) $RMSE$ (Root Mean Squared Error) $R^2$ (Coefficient fo Determination) bias / variance tradeoff New Stuff [Split Train Data / Test Data] code # df 라는 DataFrame이 있다고 가정 train = df.sample(frac=0.75,random_state=1) # df의 75%를 train data로 보겠다는 의미 test = d..
2021.03.07 -
Linear Models(3) - Ridge Regression
Learned Stuff Key Points One-hot Encoding Feature Selection Kbest Ridge Regression Ridge RidgeCV New Stuff [One-Hot Encoding] categorical data를 0 또는 1 의 값으로 바꿔준다 code Colab에서 돌리고 싶다면 pip install을 해야한다 pip install category_encoders from category_encoders import OneHotEncoder # X_train / X_test 라는 dataframe 이 있다고 가정 # use_cat_name = True 를 설정하면 encoded 된 column의 이름 앞에 categorical data의 이름이 prefix로..
2021.03.07 -
Linear Models(4) - Logistic Regression
Learned Stuff Key Points Train / Validation / Test Accuracy Score Logistic Regression Baseline Model Predictive Model New Stuff [Train / Validation / Test] Train data로 학습시킨 모델을 Validation data을 써서 검증을 진행한다 위 과정을 여러번 반복해서 최적의 모델을 만들어야 한다 Test data는 마지막 단계에서 예측용으로 쓴다 code # train / validation / test data를 6:2:2 비율로 나누기 from sklearn.model_selection import train_test_split # df 라는 DataFrame이 있다고 가정 ..
2021.03.07 -
Tree Based Model(1) - Decision Trees
Learned Stuff Key Points Pipeline Decision Tree Feature Importance New Stuff [Pipeline] 하나의 model을 pipeline에 담는다고 생각하면 된다 코드의 가독성이 높아진다 코드를 짠 순서에 따라 순차적으로 진행된다 code from category_encoders import OneHotEncoder from sklearn.impute import SimpleImputer from sklearn.linear_model import LogisticRegression from sklearn.pipeline import make_pipeline # X_train / y_train / X_validation / y_validation / X..
2021.03.07