The last row of the table. The response is a count, so the distribution is Poisson, the output layer is \(\exp\), and the loss is the negative Poisson log-likelihood.
The rate is the exponential of a linear function, so it can never be negative. The band is one square root of the mean, which is the Poisson standard deviation. There is no separate σ to move.
alpha is the regularization constant. We set it to zero here to get the plain maximum likelihood fit.
intercept: 1.484
coefs: [ 0.092 -1.634]
The fitted coefficients are close to the ones we used to generate the data, and they read multiplicatively: one degree warmer multiplies the expected count by \(e^{0.09} \approx 1.09\).
Linear regression predicts negative counts. It also puts equal weight on an error of 10 counts whether the true value is 5 or 500, which is not what we want. The wrong distribution is not a small mistake that a bigger model will absorb.
The same likelihood, with a learned \(\eta\)
Only \(\eta\) changes. The exponential and the loss are copied straight from the linear version.
The exponential is the inverse link, and it is the output layer. It keeps the rate positive.
2
The negative Poisson log-likelihood, dropping the \(\log y!\) term, which does not depend on the parameters. The small constant inside the log guards against a rate of exactly zero.
3
Standardization computed on the training part only. The linear model did not need it; gradient descent does.
The network matches the Poisson regression and does not beat it. It should not: the data really was generated by an exponential of a linear function, so the linear model is exactly right and the network can only spend parameters rediscovering it.
That is the honest outcome to expect whenever the linear predictor is adequate, and it is why a ladder of models beginning with the simplest one is the right way to work.
Figure 39.2: Residuals against the predicted count. The spread grows with the prediction, which is what a Poisson model expects.
For a normal model this plot would be a warning sign. For a Poisson model it is exactly what we expect, since the variance equals the mean.
If the spread is larger than the mean, the data is overdispersed. A negative binomial model is then a better choice.
What comes next
Week 8 takes this same pair of models to a real data set, where the linear predictor is not adequate, and where getting the features right turns out to matter more than either choice on this page.