[Fix] All thresholds, Increase Batch Predict Limit, Make "Back" Button on error page trigger a new pageload. (#432)

Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#432
This commit is contained in:
2026-07-24 09:29:05 +12:00
parent d657c0285a
commit 7632b3a029
6 changed files with 30 additions and 11 deletions

View File

@ -3003,7 +3003,14 @@ class PackageBasedModel(EPModel):
prec, rec = dict(), dict()
for t in np.arange(0, 1.05, 0.05):
thresholds = list(np.arange(0, 1.05, 0.05))
# Add specific threshold set during object creation if not already present
if np.float64(threshold) not in thresholds:
thresholds.append(np.float64(threshold))
thresholds.sort()
for t in thresholds:
temp_thresholded = (y_pred_filtered >= t).astype(int)
prec[f"{t:.2f}"] = precision_score(
y_test_filtered, temp_thresholded, zero_division=0
@ -3013,7 +3020,14 @@ class PackageBasedModel(EPModel):
return acc, prec, rec
def evaluate_mg(model, pathways: Union[QuerySet["Pathway"] | List["Pathway"]], threshold):
thresholds = np.arange(0.1, 1.1, 0.1)
thresholds = list(np.arange(0, 1.05, 0.05))
# Add specific threshold set during object creation if not already present
if np.float64(threshold) not in thresholds:
thresholds.append(np.float64(threshold))
thresholds.sort()
logger.info(f"Thresholds: {thresholds}")
precision = {f"{t:.2f}": [] for t in thresholds}
recall = {f"{t:.2f}": [] for t in thresholds}
@ -3039,7 +3053,7 @@ class PackageBasedModel(EPModel):
s = Setting()
s.model = mod
s.model_threshold = thresholds.min()
s.model_threshold = 0.0
s.max_depth = 10
s.max_nodes = 50