Python (36) 썸네일형 리스트형 Python Day 28 - Machine Learning part 09. preprocessing ◎ Preprocessing (전처리) ○ Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.compose import ColumnTransformer # 특정 컬럼(들)만 변환할 때 사용 from sklearn.preprocessing import LabelEncoder, OrdinalEncoder, OneHotEncoder from sklearn.preprocessing import StandardScaler from sklearn.pipeline impo.. Python Day 27 - Machine Learning part 08. decision tree ◎ Decision Tree ○ Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy # 난수 생성기를 사용하기 위해서 from sklearn.model_selection import GridSearchCV, RandomizedSearchCV from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier, plot_tree from sklearn.tree import DecisionTreeRegressor # 회귀 from sklearn.metrics import confusio.. Python Day 26 - Machine Learning part 07. classification ◎ Classification ○ Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler, PolynomialFeatures from sklearn.pipeline import Pipeline from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import Logis.. Python Day 25 - Machine Learning part 06. Gradient Descent ◎ 경사하강법(Gradient Descent) 머신 러닝의 목적은 목적(비용, 손실) 함수를 최소로 만드는 계수들(w0, w1, ...)을 찾는 것. 회귀 문제인 경우 목적 함수는 MSE(w). 회귀 문제에서는 w에 대한 2차 함수에서 최솟값의 위치를 찾는 문제와 비슷. 경사 하강법 : 최솟값의 위치를 찾는 알고리즘 중 하나. 목적 함수의 임의의 위치에서 시작 그 위치에서의 접선의 기울기(gradient)를 계산하고, 접선의 기울기의 절댓값이 줄어드는 방향으로 w 값을 변경 접선의 기울기가 양수인 경우 왼쪽으로 접선의 기울기가 음수인 경우 오른쪽으로 위 과정을 충분히 반복하면 목적함수가 최솟값이 되는 위치 w를 찾을 수 있음. ○ Imports import numpy as np import pandas .. Python Day 24 - Machine Learning part 05. regression & regularization ○ Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.model_selection import train_test_split from sklearn.preprocessing import PolynomialFeatures, StandardScaler from sklearn.pipeline import Pipeline from sklearn.neighbors import KNeighborsRegressor from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet from skle.. Python Day 23 - Machine Learning part 04. regression ◎ Machine Learning(기계 학습): 지도학습(Supervised learning) : 레이블이 있는 데이터를 학습. 분류(classification) : 클래스를 분류. 회귀(regression) : 숫자 예측. 비지도학습(Unsupervised learning) : 레이블이 없는 데이터를 학습. 준지도학습(Semi-supervised learning) : 비지도학습 + 전문가 시스템. 강화학습(Reinforcement learning) : 보상과 벌칙을 통해서 학습. ○ Fish Dataset fish 데이터 셋에서 물고기의 무게(Weight) 예측. Perch(농어)의 무게를 길이 특성만으로 예측. Weight(관심 변수, 종속 변수, 레이블) ~ Length(독립 변수, 특성) KNN,.. Python Day 22 - Machine Learning part 03. train_test_split ◎ train_test_split 훈련 셋과 테스트 셋을 나누는 방법 순차적 추출(sequential sampling) 임의 추출(random sampling) 층화 추출(stratified sampling) 분류 모델 평가 지표(metrics) 정확도(accuracy) 정밀도(precision) 재현율(recall) F1-score 특성 스케일링(feature scaling) 표준화(standardization) 정규화(normalization) ○ Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn.neighbors import KNeighborsCl.. Python Day 21 - Machine Learning part 02. knn ◎ KNN ○ Imports import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # sklearn(scikit-learn) 패키지의 neighbors 모듈(파일)에서 KNeighborsClassifier 클래스를 import. from sklearn.neighbors import KNeighborsClassifier ○ Fish Dataset fish_csv = 'https://github.com/rickiepark/hg-mldl/raw/master/fish.csv' fish = pd.read_csv(fish_csv) fish.head() ○ EDA (Exploratory Data Analy.. 이전 1 2 3 4 5 다음