लो-लेवल अप्रोच: मल्टिपल एग्ज़ाम्पल्स के साथ
इस अभ्यास में, आप लो-लेवल अप्रोच की समझ को और मजबूत करेंगे। हम उस स्थिति के लिए पहली dense hidden लेयर बनाएँगे जहाँ हमारे पास कई examples हैं। मान लीजिए मॉडल प्रशिक्षित है और पहली लेयर के वेट्स weights1 और बायस bias1 उपलब्ध हैं। इसके बाद, हम borrower_features टेंसर को weights1 वैरिएबल से मैट्रिक्स मल्टिप्लिकेशन करेंगे। याद रखें कि borrower_features टेंसर में शिक्षा, वैवाहिक स्थिति, और उम्र शामिल हैं। अंत में, हम products1 + bias1 के एलिमेंट्स पर sigmoid फंक्शन लगाएँगे, जिससे 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}\)
ध्यान दें कि tensorflow से matmul() और keras() इम्पोर्ट किए जा चुके हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में TensorFlow परिचय
अभ्यास निर्देश
- फीचर्स टेंसर को वेट्स से मैट्रिक्स मल्टिप्लाई करके
products1compute करें. products1 + bias1को ट्रांसफॉर्म करने के लिए sigmoid activation फंक्शन का उपयोग करें।borrower_features,weights1,bias1, औरdense1के shapes प्रिंट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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)