how to develop model of ann in ml

Solutions on MaxInterview for how to develop model of ann in ml by the best coders in the world

showing results for - "how to develop model of ann in ml"
Kaya
29 Oct 2017
1# Initializing the ANN
2ann = tf.keras.models.Sequential()
3
4# Adding the input layer and the first hidden layer
5ann.add(tf.keras.layers.Dense(units=6, activation='relu')) # units = 6 -- has highest accuracy
6
7# Adding the second hidden layer
8ann.add(tf.keras.layers.Dense(units=6, activation='relu'))
9
10# Adding the output layer
11ann.add(tf.keras.layers.Dense(units=1, activation='sigmoid')) # units = 1 -- for binary values
12
13# Part 3 - Training the ANN
14
15# Compiling the ANN
16ann.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
17
18# Training the ANN on the Training set
19ann.fit(X_train, y_train, batch_size = 32, epochs = 100)