시간이 갈수록 이 값이 원하는 출력과 일치하기를 원합니다. 이 이미지와 일치하는 출력은 [그
림
2
-
3
]의 앵클부츠에 해당하는 레이블인 숫자
9
입니다. 다른 말로 하면 이 뉴런의 출력값이
다른 모든 뉴런보다 커야 합니다.
10
개의 레이블이 있으므로 랜덤하게 초기화할 경우 정답의 약
10
%를 맞출 것입니다. 여기서
부터 손실 함수와 옵티마이저가 에폭마다 뉴런 안의 파라미터를 조정해 이
10
%를 향상시킵
니다. 따라서 시간이 지나면 컴퓨터는 무엇이 신발이고 드레스인지 구별하는 법을 배우게 됩
니다. 코드를 실행하여 신경망이 효과적으로 서로 다른 아이템을 구별하는 방법을 학습할 때
이런 향상 과정을 보게 될 것입니다.
2.3
신경망 설계
앞서 살펴본 예를 코드로 어떻게 구현하는지 알아보죠. 먼저 [그림
2
-
5
]에 있는 신경망을 만들
어 보겠습니다.
self.linear_relu_stack = nn.Sequential(
nn.Linear(28*28, 128),
nn.ReLU(),
nn.Linear(128, 10),
nn.LogSoftmax(dim=1)
)
1
장에서
Sequential
모델을 사용했습니다. 이 모델은 이름에서 알 수 있듯이 여러 개의 층을
연속적으로 사용할 수 있습니다.
1
장에서는
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.