본문 바로가기

ML&DL(수정 중)14

K-평균 K-평균알고리즘¶ KMeans 알고리즘¶ In [10]: !wget https://bit.ly/fruits_300 -O fruits_300.npy --2021-03-23 20:48:51-- https://bit.ly/fruits_300 Resolving bit.ly (bit.ly)... 67.199.248.11, 67.199.248.10 Connecting to bit.ly (bit.ly)|67.199.248.11|:443... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://github.com/rickiepark/hongong-ml/raw/master/fruits_300.npy [follo.. 2022. 3. 22.
군집 알고리즘 군집알고리즘¶ 비지도학습¶ 타깃이 없을 때 사용하는 머신러닝 알고리즘¶ In [12]: !wget https://bit.ly/fruits_300_data -O fruits_300.npy --2021-03-22 17:50:57-- https://bit.ly/fruits_300_data Resolving bit.ly (bit.ly)... 67.199.248.11, 67.199.248.10 Connecting to bit.ly (bit.ly)|67.199.248.11|:443... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://github.com/rickiepark/hg-mldl/raw/mast.. 2022. 3. 22.
트리 알고리즘-3 트리의 앙상블¶ 랜덤포레스트¶ In [1]: import numpy as np import pandas as pd from sklearn.model_selection import train_test_split wine = pd.read_csv('https://bit.ly/wine-date') data = wine[['alcohol','sugar','pH']].to_numpy() target = wine['class'].to_numpy() train_input, test_input, train_target, test_target = train_test_split(data, target, test_size=0.2, random_state=42) In [4]: from sklearn.model_selectio.. 2022. 3. 22.
트리 알고리즘-2 교차 검증과 그리드 서치¶ 검증세트¶ In [3]: import pandas as pd wine = pd.read_csv('https://bit.ly/wine-date') In [5]: data = wine[['alcohol','sugar','pH']].to_numpy() target = wine['class'].to_numpy() In [6]: from sklearn.model_selection import train_test_split train_input, test_input, train_target, test_target = train_test_split(data, target, test_size=0.2, random_state=42) In [7]: sub_input, val_input, sub_.. 2022. 3. 22.