  This Letter describes a search for narrowly resonant new physics using a
machine-learning anomaly detection procedure that does not rely on a signal
simulations for developing the analysis selection. Weakly supervised learning
is used to train classifiers directly on data to enhance potential signals. The
targeted topology is dijet events and the features used for machine learning
are the masses of the two jets. The resulting analysis is essentially a
three-dimensional search $A\rightarrow BC$, for
$m_A\sim\mathcal{O}(\text{TeV})$, $m_B,m_C\sim\mathcal{O}(100\text{ GeV})$ and
$B,C$ are reconstructed as large-radius jets, without paying a penalty
associated with a large trials factor in the scan of the masses of the two
jets. The full Run 2 $\sqrt{s}=13$ TeV $pp$ collision data set of 139 fb$^{-1}$
recorded by the ATLAS detector at the Large Hadron Collider is used for the
search. There is no significant evidence of a localized excess in the dijet
invariant mass spectrum between 1.8 and 8.2 TeV. Cross-section limits for
narrow-width $A$, $B$, and $C$ particles vary with $m_A$, $m_B$, and $m_C$. For
example, when $m_A=3$ TeV and $m_B\gtrsim 200$ GeV, a production cross section
between 1 and 5 fb is excluded at 95% confidence level, depending on $m_C$. For
certain masses, these limits are up to 10 times more sensitive than those
obtained by the inclusive dijet search. These results are complementary to the
dedicated searches for the case that $B$ and $C$ are Standard Model bosons.
