5. Improving Model Accuracy
Activity 5.01: Weight Regularization on an Avila Pattern Classifier
In this activity, you will build a Keras model to perform classification on the Avila pattern dataset according to given network architecture and hyperparameter values. The goal is to apply different types of weight regularization on the model, that is, L1
and L2
, and observe how each type changes the result. Follow these steps to complete this activity:
- Load the dataset and split the dataset into a
training set
and atest set
:# Load the dataset import pandas as pd X = pd.read_csv('../data/avila-tr_feats.csv') y = pd.read_csv('../data/avila-tr_target.csv') """ Split the dataset into training set and test set with a 0.8-0.2 ratio """ from sklearn.model_selection import train_test_split seed = 1 X_train, X_test, y_train, y_test = \ train_test_split(X, y, test_size=0.2, random_state=seed)
- Define a Keras sequential model with three...