<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 model
<img style="float
Step1:  The original data is 90 degree off. So in data loading function, I use transpose to fix it.
However, the transposed data is not compatible to given parameters because those parameters are trained by original data. So for the sake of applying given parameters, I need to use original data
Step2:  feed forward prediction
Step3:  accuracy
so... accuracy on training data is not predicting the real world performance you know
All we can say is NN is very powerful model. Overfitting is easy here.
<ASSISTANT_TASK:>
Python Code:
theta1, theta2 = nn.load_weight('ex3weights.mat')
theta1.shape, theta2.shape
Explanation: model
<img style="float: left;" src="../img/nn_model.png">
load weights and data
End of explanation
X, y = nn.load_data('ex3data1.mat',transpose=False)
X = np.insert(X, 0, values=np.ones(X.shape[0]), axis=1)  # intercept
X.shape, y.shape
Explanation: The original data is 90 degree off. So in data loading function, I use transpose to fix it.
However, the transposed data is not compatible to given parameters because those parameters are trained by original data. So for the sake of applying given parameters, I need to use original data
End of explanation
a1 = X
z2 = a1 @ theta1.T # (5000, 401) @ (25,401).T = (5000, 25)
z2.shape
z2 = np.insert(z2, 0, values=np.ones(z2.shape[0]), axis=1)
a2 = lr.sigmoid(z2)
a2.shape
z3 = a2 @ theta2.T
z3.shape
a3 = lr.sigmoid(z3)
a3
y_pred = np.argmax(a3, axis=1) + 1  # numpy is 0 base index, +1 for matlab convention
y_pred.shape
Explanation: feed forward prediction
End of explanation
print(classification_report(y_pred, y_pred))
Explanation: accuracy
so... accuracy on training data is not predicting the real world performance you know
All we can say is NN is very powerful model. Overfitting is easy here.
End of explanation
<END_TASK>