Chapter 2: Machine Learning versus Deep Learning
Activity 2: Creating a Logistic Regression Model Using Keras
Solution:
- Open a Jupyter Notebook from the start menu to implement this activity. Load in the bank dataset from the previous chapter. This should be somewhat preprocessed, we will use the pandas library for the data loading, so import the pandas library:
import pandas as pd
feats = pd.read_csv(‘bank_data_feats.csv’)
target = pd.read_csv(‘bank_data_target.csv’)
- For the purposes of this activity, we will not perform any further preprocessing. As we did in the previous chapter, we will split the dataset into training and testing and leave the testing, until the very end when we evaluate our models:
from sklearn.model_selection import train_test_split
test_size = 0.2
random_state = 42
X_train, X_test, y_train, y_test = train_test_split(feats, target, test_size=test_size, random_state=random_state)
- We begin creating our model by initializing a model of...