Model Compilation and Training
In most cases, the code to compile your model will look something like Figure
A-3
.
Figure A-3. Code to compile a model in Keras
However, there are many more parameters to consider:
•
optimizer: Passes in the name of the optimizer in the string or an
instance of the optimizer (you call the optimizer with whatever
parameters you like. We will elaborate on this further below in the
Optimizers section.)
•
loss: Passes in the name of the loss function or the function itself.
We elaborate on what we mean by this below in the
Losses section.
•
metrics: Passes in the list of metrics that you want the model to
evaluate during the training and testing processes. Check out the
Metrics section for more details on what metrics you can use.
•
loss_weights: If you have multiple outputs and multiple losses, the
model evaluates based on the total loss. The loss_weights are a list
or dictionary that determines how much each loss factors into the
overall, combined loss. With the new weights, the overall loss is now
the weighted sum of all losses.
•
Do'stlaringiz bilan baham: |