शुरू करेंमुफ़्त में शुरू करें

TensorFlow के साथ न्यूरल नेटवर्क को ट्रेन करना

पिछले अभ्यास में, आपने एक मॉडल model(w1, b1, w2, b2, features) और एक loss फंक्शन loss_function(w1, b1, w2, b2, features, targets) परिभाषित किया था, और ये दोनों इस अभ्यास में उपलब्ध हैं. अब आप मॉडल को ट्रेन करेंगे और फिर उसके प्रदर्शन का मूल्यांकन करेंगे, जहाँ आप test सेट में default outcomes की भविष्यवाणी करेंगे. यह test सेट test_features और test_targets से बना है और आपके पास उपलब्ध है. Trainable वैरिएबल हैं: w1, b1, w2, और b2. इसके अतिरिक्त, आपके लिए निम्न ऑपरेशंस इम्पोर्ट किए गए हैं: keras.activations.relu() और keras.layers.Dropout().

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में TensorFlow परिचय

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Optimizer को minimization करने के लिए सेट करें.
  • चारों trainable वैरिएबल को var_list में उसी क्रम में जोड़ें, जिसमें वे loss_function() के आर्ग्युमेंट्स के रूप में आते हैं.
  • मॉडल और test_features का उपयोग करके test_targets के लिए मान predict करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# 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)
कोड संपादित करें और चलाएँ