# LL Null custom implementation

I need to recreate some of the results of R in a python library, specifically LL-Null. I know that it describes

The null deviance shows how well the response is predicted by the model with nothing but an intercept.

# Question

Does this mean that I use an already-fit model and 0 out all the non-intercept weights? If not, how would this go? I need to implement it custom for an internal library I am building

For instance, in an OLS model, you can show that the value $$\beta_0$$ that minimizes the square error $$\sum_i (y_i - \beta_0)^2$$ is $$\beta_0=\bar{y}$$ the sample mean of $$y$$.
It's generally the case that the sample mean of $$y$$ is different from the intercept of a regression model that includes one or more features/independent variables.