Figure 1. Chirps per Minute vs Temperature in Celsius
The plot shows the temperature rising with the number of chirps. Is this relationship between chirps and temperature linear? Yes, you could draw a single straight line like thw following approximate this relationship:
Figure 2. A linear relationship
True, the line doesn't pass through every dot, but the line does clearly show the relationship between chirps and temperature. Usint the equation for a line, you could write down the relationship as follows:
where:
By convention in machine learning, you'll write the equation for a model slightly differently:
where:
To infer(predict) the temperature for a new chirps-per-minute value , just subsititue the value into this model
Although this model uses only one feature, a more sophisticated model might rely on multiple features, each having a seerate weight. For example, a model that relies on three features might look as follows:
Training a model means learning (determining) good values for all the weights and the bias from labled examples.
Loss is the penalty for a bad prediction. That is, loss is a number indicating how bad the model's prediction was on a single example.
= the square of the difference between the label and the prediction
= (obaservation - prediction(x))^2
= (y-y')^2
the everate squared loss per example over the whole datasheet. To calculate MSE, sum up all the squared losses for individual examples and then divide by the number of examples:
where: