Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -62,8 +62,27 @@ def missing_for(action: str, hud: dict):
|
|
| 62 |
return miss
|
| 63 |
|
| 64 |
# ---------- Model ----------
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
def MPP_logistic(X, L, k, x0):
|
| 69 |
e = np.exp(-float(k) * (X - float(x0)))
|
|
|
|
| 62 |
return miss
|
| 63 |
|
| 64 |
# ---------- Model ----------
|
| 65 |
+
import numpy as np
|
| 66 |
+
import matplotlib.pyplot as plt
|
| 67 |
+
|
| 68 |
+
def Y_logistic_zero(X, L, k, x0):
|
| 69 |
+
"""
|
| 70 |
+
Logistic-like yield function that forces Y(0) = 0.
|
| 71 |
+
L = maximum yield (asymptote)
|
| 72 |
+
k = slope parameter
|
| 73 |
+
x0 = inflection point (fertilizer where curve steepens)
|
| 74 |
+
"""
|
| 75 |
+
return L * (1 - np.exp(-k * X)) / (1 + np.exp(-k * (X - x0)))
|
| 76 |
+
|
| 77 |
+
# Example
|
| 78 |
+
X = np.linspace(0, 150, 200)
|
| 79 |
+
Y = Y_logistic_zero(X, L=1200, k=0.06, x0=60)
|
| 80 |
+
|
| 81 |
+
plt.plot(X, Y)
|
| 82 |
+
plt.xlabel("Fertilizer (lbs)")
|
| 83 |
+
plt.ylabel("Yield")
|
| 84 |
+
plt.title("Shifted logistic yield (Y(0)=0)")
|
| 85 |
+
plt.show()
|
| 86 |
|
| 87 |
def MPP_logistic(X, L, k, x0):
|
| 88 |
e = np.exp(-float(k) * (X - float(x0)))
|