In this section, we'll build three types of classifiers and assess their performance: a logistic regression classifier, a random forest, and a neural network.
Building the models
Logistic regression
We discussed the intuition behind and basics of logistic regression models in Chapter 3, Machine Learning Foundations. To build a model on our training set, we use the following code:
from sklearn.linear_model import LogisticRegression
clfs = [LogisticRegression()]
for clf in clfs:
clf.fit(X_train, y_train.ravel())
print(type(clf))
print('Training accuracy: ' + str(clf.score(X_train, y_train)))
print('Validation accuracy: ' + str(clf.score(X_test, y_test)))
coefs = {
'column...