  Kohn-Sham regularizer (KSR) is a differentiable machine learning approach to
finding the exchange-correlation functional in Kohn-Sham density functional
theory (DFT) that works for strongly correlated systems. Here we test KSR for
weak correlation. We propose spin-adapted KSR (sKSR) with trainable local,
semilocal, and nonlocal approximations found by minimizing density and total
energy loss. We assess the atoms-to-molecules generalizability by training on
one-dimensional (1D) H, He, Li, Be, Be$^{++}$ and testing on 1D hydrogen
chains, LiH, BeH$_2$, and helium hydride complexes. The generalization error
from our semilocal approximation is comparable to other differentiable
approaches, but our nonlocal functional outperforms any existing machine
learning functionals, predicting ground-state energies of test systems with a
mean absolute error of 2.7 milli-Hartrees.
