목록인공지능 (30)
59doit

(2) 미니배치 # 필요한 모듈 및 임포트 import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split # breast cancer 데이터 활용 cancer = load_breast_cancer() x = cancer.data y = cancer.target x_train_all, x_test, y_train_all, y_test = train_test_split(x, y, stratify=y, test_size=0.2, random_state=42) x_train, x_val, y_train, ..

앞서 구현했던 SinglLayer 기반으로 2중 신경망을 만들기 # 필요한 모듈 및 임포트 import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split # breast cancer 데이터 활용 cancer = load_breast_cancer() x = cancer.data y = cancer.target x_train_all, x_test, y_train_all, y_test = train_test_split(x, y, stratify=y, test_size=0.2, random_state=42..

신경망 알고리즘 벡터화하기 # 필요한 모듈 및 임포트 import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split # breast cancer 데이터 활용 cancer = load_breast_cancer() x = cancer.data y = cancer.target x_train_all, x_test, y_train_all, y_test = train_test_split(x, y, stratify=y, test_size=0.2, random_state=42) x_train, x_val, y_t..
가중치규제 : 과대적합 해결방법중 하나 가중치의 값이 커지지 않도록 제한하는 기법 가중치를 규제하면 일반화 성능이 올라간다. 경사가 급한 그래프보다는 경사가 완만한 그래프가 성능이 좋다 알파 : 규제의 양을 조절하는 파라미터 알파값이 크면 전체 손실함수의 값이 커지지 않도록 w의 값의 합이 작아져야한다 : 규제강화 알파값이 작으면 w의 값이 커져도 손실함수 값은 큰폭으로 커지지않는다 : 규제완화 L1규제의 미분 w_grad += alpha * np.sign(w) np.sign() : 배열 요소의 부호를 반환한다 절편은 규제하면 모델을 어떤 방향으로 이동시킬 뿐 복잡도에는 영향 없다 회귀모델 손실함수에 l1규제 : 라쏘 로지스틱 회귀에 규제 적용하기 # 1. 그레이디언트 업데이트 수식에 패널티 항 반영하기..