Welcome back.
We finished creating the model.
Now let's compile it.
We use model the name of our model dot compile.
And here we have to pass three parameters the optimizer the loss and the metrics.
Ma let me explain step by step the model compilation.
What model compilation does compilation configures the model for training by specifying how to learn.
Optimizer, what to minimize loss function how to measure progress, which is the metrics.
Okay, so compile the model means configuring the model for training by specifying the optimizer loss
function and the metric.
How to learn, what to minimize, how to measure progress.
So we're going to specify them using the compile function.
Here we'll start by the optimizer equals to tf TensorFlow dot optimizer dot s g SGD.
The algorithm that updates the model's weight during training, reducing errors and the learning rate
which is the parameter inside this function.
Learning rate controls how big each weight update step is.
The learning rate zero point if I specify 0.1, which is too high, might overshoot the optimal weights,
and if I specify 0.001, which is too low, training becomes very slow.
So in order to balance this problem we use 0.01.
Not very fast and not very slow.
Training would be Accurate and not optimal and not very slow.
Then we need to specify the loss.
Loss.
Here we have MC MSE mean squared error measures how wrong the predictions are.
Using this formula MSE equals to the average of true price minus predicted price to power squared.
Okay.
So we are calculating this using the the the training and the testing data.
So we are comparing those.
And we get by this formula this average in order to track our loss.
Why MSE for regression.
Because it penalizes large errors more heavily.
Smooth curve helps gradient descent and the standard for regression problems.
So we use it with standard regression problems.
Exactly like this problem.
M, m or m a mean absolute error.
Alternative way to measure errors.
The formula is average of the absolute value of true price minus predicted price.
Okay, the last MSE used for training and may used for monitoring human interpretation.
As a quick recap, we need to pass three parameters in order to compile the model.
For the compile function, we have the optimizer.
The optimizer is simple and is used in simple problems that didn't need complex optimizers.
Learning rate 0.01.
Fast enough to learn it quickly.
Slow enough to be stable.
MSE loss standard for regression matches your squared error in data generation.
M easy to interpret.
Average color error.
For example.
In summary, compilation tells the model.
Learn using gradient descent.
Measure errors with MSE and show me as a progress report.
I want from you to write all those notes down because those are very important.
By the way, don't, uh worry, I'm gonna provide you with all of those notes, all of those notebooks
with detailed explanation.
So as a quick recap, compilation tells the model, learn using gradient descent, measure errors with
MSE and show me Ma as a progress report.