Loss FunctionπͺΆ
The Project 2 loss function is a linear combination of terms that encode: - physical consistency - observational agreement - regularization - spectral ordering.
This is designed so that the weighted summation of these terms defines a family of admissible Hamiltonians to be explored by the model during training. As such, the recovered potential should be interpreted as a single plausible solution within a constrained inverse-problem solution space rather than a unique reconstruction of the ground-truth operator.
Mathematical FormulationπͺΆ
Four Loss Terms
-
π SchrΓΆdinger residual (physics loss)
\[ \mathcal{L}_\text{TISE} = \sum_{n=1}^N { \left| \hat{H}_\theta\hat{\psi}_n^\theta(x)-E_n^\theta \hat{\psi}_n^\theta(x) \right|^2 } \] -
π Scale-aware smoothness
\[ \mathcal{L}_\text{smooth} = \Big< \frac{\left\| V_\theta''(x) \right\|^2}{\epsilon+\left\| V_\theta(x) \right\|^2} \Big> \] -
π©· Data mismatch (noisy observables)
\[ \mathcal{L}_\text{data} = \frac{1}N\sum_{n=1}^N{\big(E_n^\theta-E_n^\text{obs}\big)^2} + \frac{1}N\sum_{n=1}^{N}\frac{1}{M}\sum_{j=1}^M{\Big( |\hat{\psi}_{n}^\theta(x_j)|^2-\rho_n^\text{obs}(x_j)\Big) ^2} \] -
π©΅ Energy ordering
\[ \mathcal{L}_\text{order} = \frac{1}{N-1}\sum_{n=0}^{N-2}{\bigg[\max{\big(0, E_n^\theta - E_{n+1}^\theta\big)} \bigg]^2} \]
π Total Loss
\[ \mathcal{L}_\text{tot} = \lambda_1 \mathcal{L}_\text{TISE} + \lambda_2 \mathcal{L}_\text{smooth} + \lambda_3 \mathcal{L}_\text{data} + \lambda_4 \mathcal{L}_\text{order} \]
Description of TermsπͺΆ
Loss Table
| Loss Term | Soft vs. Hard | Classification | Notes | π Script | π Relevant Definitions |
|---|---|---|---|---|---|
| π 1. SchrΓΆdinger residual (physics loss) | Soft | Physics / consistency loss | Enforces physical law (TISE). | physics.py |
tise_residual(), tise_loss() |
| π 2. Scale-aware smoothness | Soft | Regularizer / prior | Penalizes curvature in \(V_\theta(x)\). Encourages smoother, physically plausible potentials and stabilizes the inverse problem. | physics.py |
potential_smoothness_loss() |
| π©· 3. Data mismatch (observables) | Soft | Supervised data-fit loss | Matches learned energies and densities to noisy observed measurements. | inverse.py |
data_mismatch_loss() |
| π©΅ 4. Energy ordering | Soft | Ordering penalty / constraint | Encourages \(E_0 < E_1 < \cdots\). Helps prevent state swapping and preserves consistent mode indexing. | physics.py |
energy_ordering_loss() |
| π Total loss | Soft | Composite objective | Weighted sum of the active terms. Static scalar weights are used. | train.py |
train_step() |