I am trying to figure out how the intercept is calculated for logistic regression lasso using coordinate descent algorithm based on this seminal paper:
[Friedman, J., Hastie, T. & Tibshirani, R. Regularization Paths for Generalized Linear Models via Coordinate Descent. Journal of statistical software 33, 1-22 (2010).](http://www.jstatsoft.org/v33/i01/paper)

In the case of linear regression, the authors clearly stated that the intercept is $\hat{\beta}\_0=\bar{y}$, which is very obvious to see. Then, in the logistic regression case, they defined a "working response" $z\_i$ which they simply substituted for the $y\_i$ for the coordinate update in the linear regression case. However, unlike linear regression, it seems to me that $\beta\_0$ also needs to be updated in each loop since this "working response" directly involves both the intercept and all coefficients. The author didn't seem to give a clear clarification on how to do this. So my questions is: how is the intercept updated for the logistic regression? Do I just simply replace $y\_i$ with $z\_i$ and use $\hat{\beta}\_0=\bar{z}$? If so, what's the mathematical justification for it? I'm not familiar with Fortran and their core code for logistic regression was written without any comment/explanation and is just too much for me to wade through.

Thanks.