Menu

1 / 7

Implementing Maximum Likelihood Estimation in Logistic Regression Using Python: BFGS Optimization

DataDrivenInvestor - Medium·Tuhin Das·11 days ago
#nUlqn52U
Long article (2144 words) — no AI summary yet.
Reading 0:00
15s threshold

Implementing Maximum Likelihood Estimation in Logistic Regression Using Python: Understanding BFGS Optimisation

Tuhin Das

9 min read4 hours ago

Source: Wikimedia Commons

When we use Logistic Regression in Python, we usually write something as simple as:

from sklearn.linear_model import LogisticRegression

model = LogisticRegression()

model.fit(X, y)

But what actually happens behind the scenes when we call fit() ?

How does the model estimate its coefficients? How does it decide when to stop? And what role does an optimisation algorithm play in this process?

In this article, I will build a Logistic Regression model from scratch using Python, without relying on Scikit-learn for the estimation process.

We will use Maximum Likelihood Estimation (MLE) to estimate the coefficients and BFGS as the numerical optimisation algorithm.

The objective is not just to build a working model, but to understand the mathematics behind the code.

1.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.