[Python] Fashion-MNIST 데이터를 이용하여 예측 평가하기
📌 ################################################## # Fashion-MNIST 데이터셋 다운로드 from tensorflow.keras.datasets.fashion_mnist import load_data (x_train, y_train), (x_test, y_test) = load_data() print(x_train.shape,x_test.shape) #(60000, 28, 28) (10000, 28, 28) class_names=['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot'] y_train[:10] # [9, 0..
2023. 4. 27.
[Python] MNIST 데이터를 이용하여 숫자를 학습하여 숫자 인식
📌 # MNIST 데이터를 이용하여 숫자를 학습하여 숫자 인식하기. # MNIST 데이터셋 다운받기 from tensorflow.keras.datasets.mnist import load_data (x_train, y_train),(x_test, y_test)=\\ load_data(path='mnist.npz') x_train.shape # (60000, 28, 28), 훈련데이터 y_train.shape # (60000,) x_test.shape # (10000, 28, 28), 테스트데이터 y_test.shape # (10000,) import matplotlib.pyplot as plt import numpy as np # 0~59999 사이의 임의의 수 3개 random_idx = np.rand..
2023. 4. 27.
[Python] 딥러닝 - 가중치와 편향, 다중 퍼센트론
📌 ''' 퍼셉트론을 이용하여 XOR 게이트 구현 단일 신경망으로 구현 안됨 다중 신경망으로 구현해야 한다. 단일 퍼센트론 : 입력층 - 출력층 다중 퍼센트론 : 입력층 - 은닉층 - 출력층 ''' def XOR(x1,x2) : s1 = NAND(x1,x2) s2 = OR(x1,x2) y = AND(s1,s2) return y for xs in [(0,0), (0,1), (1,0), (1,1)] : y = XOR(xs[0], xs[1]) print(xs,"=>",y)
2023. 4. 27.