वेट में बदलाव से एक्यूरेसी पर असर कोड करके देखना
अब आप एक असली नेटवर्क में वेट बदलेंगे और देखेंगे कि वे मॉडल की एक्यूरेसी को कैसे प्रभावित करते हैं!
निम्नलिखित न्यूरल नेटवर्क पर नज़र डालिए:

इसके वेट पहले से weights_0 के रूप में लोड हैं। इस अभ्यास में आपका काम weights_0 में सिर्फ एक वेट अपडेट करके weights_1 बनाना है, जो परफेक्ट प्रेडिक्शन दे (जहाँ प्रेडिक्टेड वैल्यू target_actual: 3 के बराबर हो)।
ज़रूरत पड़े तो पेन और पेपर का इस्तेमाल करके अलग-अलग कॉम्बिनेशन आज़माएँ। आप predict_with_network() फंक्शन का उपयोग करेंगे, जो पहले आर्ग्युमेंट के रूप में डेटा की array लेता है और दूसरे आर्ग्युमेंट के रूप में वेट्स।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Deep Learning परिचय
अभ्यास निर्देश
weights_1नाम की वेट्स की एक डिक्शनरी बनाएँ, जिसमें आपनेweights_0से 1 वेट बदला हो (परफेक्ट प्रेडिक्शन पाने के लिए आपकोweights_0में सिर्फ 1 बदलाव करना है)।- नए वेट्स के साथ
predict_with_network()फंक्शन का उपयोग करकेinput_dataऔरweights_1से प्रेडिक्शन प्राप्त करें। - नए वेट्स के लिए error निकालें:
model_output_1में सेtarget_actualघटाएँ। - 'Submit Answer' दबाएँ और देखें कि errors कैसे तुलना करते हैं!
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# The data point you will make a prediction for
input_data = np.array([0, 3])
# Sample weights
weights_0 = {'node_0': [2, 1],
'node_1': [1, 2],
'output': [1, 1]
}
# The actual target value, used to calculate the error
target_actual = 3
# Make prediction using original weights
model_output_0 = predict_with_network(input_data, weights_0)
# Calculate error: error_0
error_0 = model_output_0 - target_actual
# Create weights that cause the network to make perfect prediction (3): weights_1
weights_1 = {'node_0': [____, ____],
'node_1': [____, ____],
'output': [____, ____]
}
# Make prediction using new weights: model_output_1
model_output_1 = ____
# Calculate error: error_1
error_1 = ____ - ____
# Print error_0 and error_1
print(error_0)
print(error_1)