Logistic Function to Represent Transition
A logistic function (also called a sigmoid) is a non-linear function bounded between 0 and 1. As t → − ∞ , p ( s ∣ t ) → 0 {t \to -\infty}, {p(s|t) \to 0} t→−∞,p(s∣t)→0 and, as t → + ∞ , p ( s ∣ t ) → 1 {t \to +\infty}, {p(s|t) \to 1} t→+∞,p(s∣t)→1. The expression for a logistic probability distribution for sleep as a function of time is:
p ( s ∣ t ) = 1 1 + e β t p(s|t) = \frac{1}{ 1 + e^{\;\beta t } } p(s∣t)=1+eβt1
Several logistic functions with various β \beta β parameters are shown below:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from IPython.core.pylabtools import figsize
figsize(12, 6)
# Logistic function with only beta
def logistic(x, beta):
return 1. / (1. + np.exp(beta * x))
# Plot examples with different betas
x = np.linspace(-5, 5, 1000)
for beta in [-5, -1, 0.5, 1, 5]:
plt.plot(x, logistic(x, beta), label = r"$\beta$ = %.1f" % beta)
plt.legend();
plt.title(r'Logistic Function with Different $\beta$ values');