This issue was found by a Codex global repository scan of tracked non-test files at commit 8c93925cb10b401b2b83c738bd9263fd74474468.
Relevant code
|
_, y_smooth_pred = fit_pchip( |
|
res, x_col="Displacement", y_col="Energy", num_points=NUM_POINTS |
|
) |
|
|
|
derivative_label = ( |
|
(y_smooth_label[1:] - y_smooth_label[:-1]) |
|
* (NUM_POINTS - 1) |
|
/ max(y_smooth_label) |
|
) |
|
derivative_pred = ( |
|
(y_smooth_pred[1:] - y_smooth_pred[:-1]) * (NUM_POINTS - 1) / max(y_smooth_pred) |
|
) |
|
|
|
return np.round(mean_absolute_error(y_smooth_label, y_smooth_pred), 4), np.round( |
|
mean_absolute_error(derivative_label, derivative_pred), 4 |
|
) |
Impact
The derivative metric normalizes by max(y_smooth_pred). A calculator that predicts a flat energy curve produces y_smooth_pred == 0 after subtracting the minimum, so the denominator is zero. The resulting NaN values can make the derivative MAE invalid or fail the task instead of assigning a defined penalty for a bad trajectory.
Suggested fix
Guard zero or near-zero denominators and assign a defined derivative penalty, or mark that trajectory as failed while allowing the rest of the task to complete. Add a regression test with constant predicted energies.
This issue was found by a Codex global repository scan of tracked non-test files at commit
8c93925cb10b401b2b83c738bd9263fd74474468.Relevant code
LAMBench/lambench/tasks/calculator/stacking_fault/stacking_fault.py
Lines 34 to 49 in 8c93925
Impact
The derivative metric normalizes by
max(y_smooth_pred). A calculator that predicts a flat energy curve producesy_smooth_pred == 0after subtracting the minimum, so the denominator is zero. The resultingNaNvalues can make the derivative MAE invalid or fail the task instead of assigning a defined penalty for a bad trajectory.Suggested fix
Guard zero or near-zero denominators and assign a defined derivative penalty, or mark that trajectory as failed while allowing the rest of the task to complete. Add a regression test with constant predicted energies.