시작하기무료로 시작하기

TensorFlow로 신경망 학습하기

이전 연습 문제에서 model(w1, b1, w2, b2, features)과 손실 함수 loss_function(w1, b1, w2, b2, features, targets)를 정의했으며, 둘 다 이번 연습 문제에서 사용할 수 있어요. 이제 모델을 학습한 뒤, test_featurestest_targets로 이루어진 테스트 세트에서 대출 연체(default) 결과를 예측하여 성능을 평가할 거예요. 학습 가능한 변수는 w1, b1, w2, b2입니다. 추가로, 다음 연산들이 이미 임포트되어 있어요: keras.activations.relu()keras.layers.Dropout().

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

Python으로 시작하는 TensorFlow

강의 보기

연습 안내

  • 옵티마이저가 최소화를 수행하도록 설정하세요.
  • 네 개의 학습 가능한 변수를 loss_function()의 인자 순서와 동일하게 var_list에 추가하세요.
  • 모델과 test_features를 사용해 test_targets에 대한 예측 값을 계산하세요.

실습형 인터랙티브 연습

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

# Train the model
for j in range(100):
    # Complete the optimizer
	opt.____(lambda: loss_function(w1, b1, w2, b2), 
                 var_list=[____, ____, ____, ____])

# Make predictions with model using test features
model_predictions = model(w1, b1, w2, b2, ____)

# Construct the confusion matrix
confusion_matrix(test_targets, model_predictions)
코드 편집 및 실행