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

मॉडल और loss फंक्शन परिभाषित करना

इस अभ्यास में, आप एक न्यूरल नेटवर्क को ट्रेन करेंगे ताकि यह अनुमान लगा सके कि कोई क्रेडिट कार्ड धारक डिफॉल्ट करेगा या नहीं। आपके पास Python शेल में borrower_features और default के रूप में वे फीचर्स और टार्गेट्स उपलब्ध हैं जिनसे आप अपना नेटवर्क ट्रेन करेंगे। आपने पिछले अभ्यास में weights और biases परिभाषित किए थे.

ध्यान दें कि predictions लेयर को \(\sigma(layer1*w2+b2)\) के रूप में परिभाषित किया गया है, जहाँ \(\sigma\) sigmoid activation है, layer1 पहले hidden dense लेयर के नोड्स का टेन्सर है, w2 weights का टेन्सर है, और b2 bias टेन्सर है.

Trainable वैरिएबल्स हैं w1, b1, w2, और b2। इसके अलावा, निम्नलिखित ऑपरेशंस आपके लिए इम्पोर्ट कर दिए गए हैं: keras.activations.relu() और keras.layers.Dropout().

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

Python में TensorFlow परिचय

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

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

  • पहले लेयर पर rectified linear unit activation फंक्शन लागू करें.
  • layer1 पर 25% dropout लागू करें.
  • क्रॉस-एंट्रॉपी loss फंक्शन को targets (टार्गेट) और predictions (प्रीडिक्टेड वैल्यूज़) पास करें.

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

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

# Define the model
def model(w1, b1, w2, b2, features = borrower_features):
	# Apply relu activation functions to layer 1
	layer1 = keras.activations.____(matmul(features, w1) + b1)
    # Apply dropout rate of 0.25
	dropout = keras.layers.Dropout(____)(____)
	return keras.activations.sigmoid(matmul(dropout, w2) + b2)

# Define the loss function
def loss_function(w1, b1, w2, b2, features = borrower_features, targets = default):
	predictions = model(w1, b1, w2, b2)
	# Pass targets and predictions to the cross entropy loss
	return keras.losses.binary_crossentropy(____, ____)
कोड संपादित करें और चलाएँ