Documentation Index
Fetch the complete documentation index at: https://ai.teamjaaf.com/llms.txt
Use this file to discover all available pages before exploring further.
🔐 Logistic Regression
Logistic regression is a linear model for binary classification. It estimates the probability that an input x belongs to the positive class.
Hypothesis
The model applies the logistic (sigmoid) function to a linear combination of the inputs:
hθ(x)=σ(xTθ)=1+e−xTθ1.
Cost Function
Parameters are learned by minimizing the logistic loss:
J(θ)=−m1i=1∑m[y(i)loghθ(x(i))+(1−y(i))log(1−hθ(x(i)))].
Example (scikit-learn)
import numpy as np
from sklearn.linear_model import LogisticRegression
X = np.array([[0], [1], [2], [3]])
y = np.array([0, 0, 1, 1])
model = LogisticRegression()
model.fit(X, y)
proba = model.predict_proba([[1.5]])
print(proba)
Interpretation
- Outputs a probability between 0 and 1.
- Decision boundary at hθ(x)=0.5.
- For multi-class problems, use one-vs-rest or a softmax regression extension.