시작하기무료로 시작하기

여러 예시로 살펴보는 로우 레벨 접근

이 연습 문제에서는 여러 개의 예시가 있는 경우에 대해 첫 번째 밀집 은닉층을 구성하면서 로우 레벨 접근에 대한 직관을 더 쌓아 보겠습니다. 모델은 이미 학습되었고 첫 번째 층의 가중치 weights1와 편향 bias1가 준비되어 있다고 가정합니다. 그런 다음 borrower_features 텐서를 변수 weights1과 행렬 곱셈합니다. borrower_features 텐서에는 학력, 혼인 상태, 나이가 포함되어 있음을 기억하세요. 마지막으로 products1 + bias1의 각 원소에 시그모이드 함수를 적용하여 dense1을 얻습니다.

\(products1 = \begin{bmatrix} 3 & 3 & 23 \\ 2 & 1 & 24 \\ 1 & 1 & 49 \\ 1 & 1 & 49 \\ 2 & 1 & 29 \end{bmatrix} \begin{bmatrix} -0.6 & 0.6 \\ 0.8 & -0.3 \\ -0.09 & -0.08 \end{bmatrix}\)

matmul()keras()tensorflow에서 이미 임포트되어 있습니다.

이 연습은 강의의 일부입니다

Python으로 시작하는 TensorFlow

강의 보기

연습 안내

  • 특성 텐서와 가중치를 행렬 곱해 products1을 계산하세요.
  • 시그모이드 활성화 함수를 사용해 products1 + bias1을 변환하세요.
  • borrower_features, weights1, bias1, dense1의 모양을 출력하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Compute the product of borrower_features and weights1
products1 = ____

# Apply a sigmoid activation function to products1 + bias1
dense1 = ____

# Print the shapes of borrower_features, weights1, bias1, and dense1
print('\n shape of borrower_features: ', borrower_features.shape)
print('\n shape of weights1: ', ____.shape)
print('\n shape of bias1: ', ____.shape)
print('\n shape of dense1: ', ____.shape)
코드 편집 및 실행