  Understanding the behaviour of complex laser systems is an outstanding
challenge, especially in the presence of nonlinear interactions between modes.
Hidden features, such as the gain distributions and spatial localisation of
lasing modes, often cannot be revealed experimentally, yet they are crucial to
determining the laser action. Here, we introduce a lasing spectroscopy method
that can visualise the gain profiles of the modes in complex lasers using an
artificial neural network. The spatial gain distributions of different lasing
modes in a disorderly coupled microring array are reconstructed without prior
knowledge of the laser topology. We further extend the neural network to a
tandem neural network that can control the laser emission by matching the modal
gain/loss profile to selectively enhance the targeted modes. This mode
visualisation method offers a new approach to extracting hidden spatial mode
features from photonic structures, which could improve our understanding and
control of complex photonic systems.
