USAAIO
1
Part 18 (5 points, coding task)
Do the following tasks in this problem.
-
Define two models:
-
model_GD = My_Log_Reg(solver='GD', lr=.01, num_iter=200)
-
model_Newton = My_Log_Reg(solver='Newton', lr=.1, num_iter=200)
-
For each model,
-
Use the training dataset to train it.
-
Print the trained coefficients coef_
.
-
Use the test dataset to compute the accuracy score. Print it.
USAAIO
2
### WRITE YOUR SOLUTION HERE ###
model_GD = My_Log_Reg(solver='GD', lr=.001, num_iter=200)
model_GD.fit(X_train_scaled, y_train)
print(model_GD.coef_)
print(model_GD.score(X_test_scaled, y_test))
model_Newton = My_Log_Reg(solver='Newton', lr=.1, num_iter=200)
model_Newton.fit(X_train_scaled, y_train)
print(model_Newton.coef_)
print(model_Newton.score(X_test_scaled, y_test))
""" END OF THIS PART """