मॉडल फिट करना
अब सबसे रोचक हिस्सा है। आप मॉडल को फिट करेंगे। याद रखिए, प्रीडिक्टिव फीचर्स के रूप में उपयोग होने वाला डेटा predictors नाम की NumPy array में लोड है और जिसे प्रेडिक्ट करना है वह डेटा target नाम की NumPy array में स्टोर है। आपका model पहले से लिखा हुआ है और इसे पिछले अभ्यास के कोड से compile किया जा चुका है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Deep Learning परिचय
अभ्यास निर्देश
modelको फिट करें। याद रखिए कि पहला आर्ग्युमेंट प्रीडिक्टिव फीचर्स (predictors) होता है, और जिसे प्रेडिक्ट करना है (target) दूसरा आर्ग्युमेंट होता है.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import necessary modules
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
# Specify the model
n_cols = predictors.shape[1]
model = Sequential()
model.add(Dense(50, activation='relu', input_shape = (n_cols,)))
model.add(Dense(32, activation='relu'))
model.add(Dense(1))
# Compile the model
model.compile(optimizer='adam', loss='mean_squared_error')
# Fit the model
____