。゚(*´□`)゚。

코딩의 즐거움과 도전, 그리고 일상의 소소한 순간들이 어우러진 블로그

[네이버클라우드] 클라우드 기반의 개발자 과정 7기/AI 17

머신러닝 2 /GridSearch, outlier, Bagging, Voting

하이퍼파라미터튜닝 -그리드서치 -아웃라이어 배깅(Bagging) 보팅(voting) 그리드서치(GridSearchCV) 하이퍼파라미터 튜닝: 임의의 값들을 넣어 더 나은 결과를 찾는 방식 ->수정 및 재시도하는 단순 작업의 반복 그리드 서치: 수백가지 하이퍼파라미터값을 한 번에 적용가능 그리드서치의 원리: 입력할 하이퍼파라미터 후보들을 입력한 후, 각 조합에 대해 모두 모델링해보고 최적의 결과가 나오는 하이퍼파라미터 조합을 확인 param = [ {'n_estimators' : [100, 200], 'max_depth':[6, 8, 10, 12], 'n_jobs' : [-1, 2, 4]}, {'max_depth' : [6, 8, 10, 12], 'min_samples_split' : [2, 3, 5, 1..

[수업자료] ml2 오늘의 코드 -gridsearch, random, bagging

그리드 서치하는 이유: 최적의 파라미터 찾으려고. 찾고나면 그리드 서치 지워버리고 파라미터만 적용하기 ml13_gridSearchCV_iris RandomForestClassifier() param = [ {'n_estimators': [100,200], 'max_depth' : [6,8,10], 'n_jobs':[-1,1,2]}, {'n_estimators': [100,500], 'min_samples_leaf':[3,5,7]} ] #2. 모델 rf_model = RandomForestClassifier() from sklearn.model_selection import GridSearchCV model = GridSearchCV(rf_model, param, cv=kfold, verbose=1) 선생..

[수업자료] ml1 오늘의 코드3

ml11_xgb_iris xgboost import numpy as np from sklearn.svm import SVC, LinearSVC from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split, KFold from sklearn.model_selection import cross_val_score, cross_val_predict from ..

머신러닝 1 / feature importance

Iris #1.datasets = load_iris() #StratifiedGroupKFold #sclaer 적용 scaler = MinMaxScaler() #2. 모델 model = RandomForestClassifier() #3. 훈련 model.fit(x,y) #4. 평가 예측 #시각화 import matplotlib.pyplot as plt n_features = datasets.data.shape[1] plt.barh(range(n_features), model.feature_importances_) plt.yticks(np.arange(n_features), datasets.feature_names) plt.title("Iris feature importances") plt.ylabel('F..

머신러닝 1 -model, scaling

퍼셉트론의 과제 : XOR (퍼셉트론으로 AND, OR 해결 가능. 하지만 ,, XOR은 못 함. 인공지능의 winter, ,,, ) AND : 0이 하나라도 있으면 0 OR: 1이 하나라도 있으면 1 XOR #1. 데이터 xor: 다르면 1 x_data = [[0,0],[0,1],[1,0],[1,1]] y_data = [0,1,1,0] #2. 모델 model = Perceptron() 모델의 score : 0.5 # [[0, 0], [0, 1], [1, 0], [1, 1]] 의 예측결과 : [0 0 0 0] # acc : 0.5 MODEL SVM 모델 (suport vecter machine) 서포트 벡터 머신은 여백(margin)을 최대화하는 지도 학습 알고리즘 여백은 주어진 데이터가 오류를 발생키지..

heatmap NaN, label Encoding - 팀플 쓰기

보스턴 이어서 시커먼 값지워주자 [4-3] 판다스... 찍 (tistory.com) 여기 이어서 [4-3] 판다스... 찍 판다스로 파일 끌고옴 금지된 보스턴 import numpy as np import pandas as pd#pandas 파일 가져오는 거 from keras.models import Sequential from keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.met timi-d.tistory.com boston_NaN 채우기, 확인하기 tf01_pd02_boston_labeling

[5-1] 개념정리 - 자연어처리(NLP) 기초

자연어처리(NLP) Natural Language Process 워드 임베딩(word Embedding) classic : 언어 별로 나누어서 pre-processing 들어감 deep learning: 일단 먼저 prepreocessing (=숫자변환) 텍스트를 컴퓨터가 이해할 수 있도록 숫자로 변환 단어를 표현하는 방법에 따라 자연어 처리의 성능이 크게 달라짐 => preprocessing 작업이 중요하다 각 단어를 인공 신경망 학습을 통해 벡터화 하는 방법임 케라스의 emdedding() -> 단어를 랜덤한 값을 가지는 ㄴ벡터로 변환한 뒤, 인공신경망의 가중치를 학습함 (텐서 라고도 함) 인공지능에서 벡터란 고차원의 숫자 배열(array) 텍스트 데이터의 벡터는 각 단어(word)를 고유한 정수(i..

[4-3] 판다스... 찍

판다스로 파일 끌고옴 금지된 보스턴 import numpy as np import pandas as pd#pandas 파일 가져오는 거 from keras.models import Sequential from keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.metrics import r2_score #[[train & test data]] #1. 데이터 path ='./_data/' x_train = pd.read_csv(path + 'train-data.csv') y_train = pd.read_csv(path + 'train-target.csv') x_test = pd.read_csv(..

[수업자료] [4-3] 합성곱 오늘의 코드..

mnist imshow import numpy as np from keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data()# 자동으로 이미지와 라벨이 x와 y에 들어가는 건가? print(x_train.shape, y_train.shape) #(60000, 28, 28) 왜 마지막에 하나 더 있지,,? 이미지라 print(x_test.shape, y_test.shape) print(x_train[0]) print(y_train[0]) ''' (60000, 28, 28) (60000,) (10000, 28, 28) (10000,) [[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0..

[4-2] Conv2D, MaxPooling, Dropout, Flatten, pyplot

[fashion_mnist] ##from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Dropout import numpy as np from keras.models import Sequential from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D, Dropout from keras.datasets import fashion_mnist #1. 데이터 (x_train, y_train), (x_test, y_test) = fashion_mnist.load_data() x_train, x_test = x_train/255.0, x_test/255.0 # print(x_train.shape, ..