59. Logistic Regression#

Logistic regression

import numpy as np

import matplotlib.pyplot as plt
import seaborn as sns; sns.set()

59.1. Limiting Behavior#

def logitx(x):
    return np.exp(x)/(1+np.exp(x))

def logit1(x):
    return 1/(1+np.exp(x))
fig, ax = plt.subplots(figsize=(10, 6.18))
x_1 = np.linspace(-10, 10, 1001)

ax.plot(x_1, [logit1(i) for i in x_1], label=r"$1/(1+\exp(x'))$")
ax.plot(x_1, [logitx(i) for i in x_1], label=r"$\exp(x')/(1+\exp(x'))$")

ax.set_xlabel(r"$x'$")
plt.legend()
<matplotlib.legend.Legend at 0x7f81ce13c250>
../../_images/logistic_regression_basics_5_1.png