전체 글 (509) 썸네일형 리스트형 비선형 SVM (커널 SVM) gamma iris 데이터에 커널 SVM 을 적용하였다. 커널함수로 방사형 기저함수 (kernel = 'rbf') 를 사용하였고 , 감마를 바꿔가며 train / test 셋의 정확도를 비교하였다. 감마가 클수록 과대적합 될 가능성이 높아지므로, 학습데이터의 정확도가 시험데이터의 정확도보다 더 높게 나타나 감마를 좀 더 감소시킬 필요가 있다. C 의 역할 ? 파라미터 C 는 허용되는 오류 양을 조절한다. C가 클수록 오류를 덜 허용 (하드마진) , C 가 작을수록 오류를 더 많이 허용 (소프트마진) gamma 의 역할 ? RBF 커널에는 파라미터 감마(gamma) 존재 결정경계를 얼마나 유연하게 그을것인지, 학습데이터에 얼마나 민감하게 반응할 것인지 조정하는 것 gamma 값을 높이면 학습 데이터에 많이 의존해서 .. train_test_split 에서 stratify 의 의미 학습 데이터와 시험 데이터로 분리 from sklearn.model_selection import train_test_split #Scikit-Learn 의 model_selection library를 train_test_split로 명명 X_train,X_test,y_train,y_test=train_test_split(X,y, test_size=0.3, random_state=1, stratify=y) # x와 y의 data를 각각 30%, 70%의 비율로 test_set과 training_set으로 나눔 학습 데이터로 자료를 학습시키고 학습에 전혀 사용하지 않은 시험데이터에 적용하여 학습 결과의 일반화가 가능한지 알아보기 위함이다. 학습 데이터와 시험 데이터 모두 동일한 비율의 y 의 범주가 포함되.. 모델 복잡도 제한을 위한 L1 , L2 규제 모델이 test 데이터셋보다 train 데이터셋에서 성능이 훨씬 높다면 과대적합이라고 한다. → 모델 파라미터가 훈련 데이터셋에 있는 특정 샘플들에 대해 너무 가깝게 맞추어져 있다는 것 → 새로운 데이터에는 잘 일반화하지 못하기 때문에 모델 분산이 크다고 한다. → 과대적합의 이유는 주어진 훈련 데이터에 비해 모델이 너무 복잡하기 때문 일반화 오차를 감소시키기 위한 방법 더 많은 train 데이터를 모은다. 규제를 통해 복잡도를 제한한다. 파라미터 개수가 적은 간단한 모델을 선택한다. 데이터 차원을 줄인다. 4.5.1 모델 복잡도 제한을 위한 L1 규제와 L2 규제 가중치 벡터 w 의 L2 규제 , L1 규제 - L1 규체는 보통 희소한 특성 벡터를 만든다. - 대부분의 특성 가중치가 0 이 된다. → .. Confusion matrix - Iris 데이터를 이용한 퍼셉트론 훈련 X : 꽃잎 길이 , 꽃잎 너비 y : 꽃 품종 Iris 데이터 불러오기 from sklearn import datasets import numpy as np iris = datasets.load_iris() X = iris.data[:,[2,3]] y = iris.target print('Class labels:', np.unique(y)) Class labels: [0 1 2] # 붓꽃의 클래스 이름인 Iris-setosa, Iris-versicolor, Iris-virginica splitting the dataset into separate training and test datasets from sklearn.model_selection import train_test_split X_train,.. 텐서플로우를 이용한 신경망 구현 예제 당뇨병 데이터셋 : https://www.kaggle.com/datasets/uciml/pima-indians-diabetes-database Pima Indians Diabetes Database Predict the onset of diabetes based on diagnostic measures www.kaggle.com import numpy as np import pandas as pd from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt # 랜덤 시드 고정 np.random.seed(5) # 피마족 인디언 당뇨병 발병 데이터셋 # 인스턴스 수 : 768 개 # 속성 수 .. 영화 관객 수 예측 모델 개발 데이콘의 영화 관객수 예측 모델 : https://dacon.io/competitions/open/235536/overview/description [문화] 영화 관객수 예측 모델 개발 - DACON 좋아요는 1분 내에 한 번만 클릭 할 수 있습니다. dacon.io - 분석목적 : 영화 관련 변수를 이용하여 영화 관객 수 예측하기 - 데이터 : movies_train.csv / movies_test.csv - 변수 title : 영화의 제목 distributor : 배급사 genre : 장르 release_time : 개봉일 time : 상영시간(분) screening_rat : 상영등급 director : 감독이름 dir_prev_bfnum : 해당 감독이 이 영화를 만들기 전 제작에 참여한 영화에서.. K-Fold Cross Validation 와 validation 데이터에 대한 이해 '영화 관객수 예측 모델' 에서 K -Fold Validation 과 validation 데이터셋은 어떤 역할을 하는지 헷갈려서 정리하고자 포스팅 GradientBoostingRegressor from sklearn.model_selection import KFold from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegressor kf = KFold(n_splits = 10, shuffle = True, random_state = 42) # 10 개의 Fold 를 만든다. rmse_list = [] gb_pred = np.zeros((test.shape[0])) for tr_idx, val_idx in kf.split(X, y) .. Raschka Ch 1. Giving Computers the Ability to Learn from Data Python Machine Learning (2019, 3rd ed., Sebastian Raschka, Vahid Mirjalili) Chapter 1 Giving Computers the Ability to Learn from Data Overview 1.1 Building intelligent machines to transform data into knowledge 1.2 The three different types of machine learning 1.2.1 Making predictions about the future with supervised learning Classification for predicting class labels Regression for predicting co.. 이전 1 ··· 59 60 61 62 63 64 다음