Keras Flashcards

1
Q

steps to specify NN in keras

A

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”)
])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

steps to compile NN in keras

A

(assuming f if a keras.sequential that has been fully specified)

f.compile(optimizer = “adam”, loss = “mean_squared_error”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

train a NN in batches using Keras

A

(assuming f if a keras.sequential that has been fully specified)

f.fit(X, Y, batch_size = 100, epochs = 5)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

predict using sequential nn in keras

A

(assuming f if a keras.sequential that has been fully specified and training is complete)

Y_hat = f.predict(X_new)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

limitations of sequential model in keras

A

restrictive for certain applications eg networks that have shared layers or non-standard routing

these can then be handled with the keras FUNCTIONAL APi

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

non linear regression example

A

page 49 on (edited ln) printed page num is 56,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how to combat overfitting

A
  • stop training early
    -regularisation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

dropout

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly