steps to specify NN in keras
import tensorflow.keras as keras
f = keras.sequential([
keras.layers.Dense(100, activation = “relu”, input_shape(2,)),
keras.layers.Dense(100, activation = “relu”),
keras.layers.Dense(1, activation = “linear”)
])
steps to compile NN in keras
(assuming f if a keras.sequential that has been fully specified)
f.compile(optimizer = “adam”, loss = “mean_squared_error”)
train a NN in batches using Keras
(assuming f if a keras.sequential that has been fully specified)
f.fit(X, Y, batch_size = 100, epochs = 5)
predict using sequential nn in keras
(assuming f if a keras.sequential that has been fully specified and training is complete)
Y_hat = f.predict(X_new)
limitations of sequential model in keras
restrictive for certain applications eg networks that have shared layers or non-standard routing
these can then be handled with the keras FUNCTIONAL APi
non linear regression example
page 49 on (edited ln) printed page num is 56,
how to combat overfitting
dropout
regularisation method
introduce a dropout layer, where each input gets randomly replaced during training by a zero value with fixed probability
results in smoother fit