We'll now start building our Keras model, which is a deep learning algorithm:
- The first thing that we're going to do is import the necessary packages and layers. We will do that by running the following lines of code:
from sklearn.model_selection import GridSearchCV, KFold
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from keras.optimizers import Adam
In the preceding code snippet , GridSearchCV is the function we will use to perform a grid search, and KFold will be used for performing the k-fold cross-validation. KerasClassifier is used as the wrapper. Adam is the optimizer that we will be using for this model; the rest of the functions are all general functions used to define the model:
- Let's start by defining the model. We will use a create_model() function, because...