%config InlineBackend.figure_formats = ['svg']
import matplotlib.pyplot as plt
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
# Define range of x (total number of units made)
x = np.exp(np.linspace(0, np.log(1000), 1000))
# Define constant parameters
K = 100
K0 = 3
n = -0.3 # np.log(2) / np.log(0.8) # Learning rate of 80%
K0 = 50
B = 10
M = 0.5
# Define models
wright = K * x ** n
plateau = np.maximum(wright, K0)
stanford_b = K * (x + B) ** n + (K - K * B ** n)
dejong = K * (M + (1 - M) * x ** n)
s_curve = K * (M + (1 - M) * (x + B) ** n) + K - K * (M + (1-M) * B ** n)
# Create log-log plot
plt.figure(figsize=(10, 6))
plt.loglog(x, wright, label="Wright's model")
plt.loglog(x, plateau, label="Plateau model")
plt.loglog(x, stanford_b, label="Stanford-B model")
plt.loglog(x, dejong, label="DeJong’s model")
plt.loglog(x, s_curve, label="S-curve model")
plt.ylim(30, 120)
plt.legend()
plt.title('Learning Curve Models')
plt.xlabel('Total Number of Units Made (log scale)')
plt.ylabel('Cost of x-th Unit (log scale)')
plt.grid(True, which="both", ls="--")
plt.show()