February 2019
Beginner to intermediate
308 pages
7h 42m
English
Now, let's implement our model architecture in Keras. Just like in the previous project, we're going to build our model layer by layer in Keras using the Sequential class.
First, split the DataFrame into the training features (X) and the target variable that we're trying to predict (y):
X = df.loc[:, df.columns != 'fare_amount'] y = df.loc[:, 'fare_amount']
Then, split the data into a training set (80%) and a testing set (20%):
from sklearn.model_selection import train_test_splitX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
Next, let's build our Sequential model in Keras according to the neural network architecture we outlined earlier:
from keras.models import Sequentialfrom ...