## 2 Materials and Methods
Here 451-components correspond to 451 spatial points uniformly distributed along the length of the two-dimensional disordered waveguide (0-26 \(\upmu\)m), and 750,000 corresponds to the data of cross-section averaged intensity distributions of ten transmission eigenchannels from disordered waveguides with three different disorder strengths (300, 400 and 500 scatterers, respectively), with 25,000 random configurations with ten transmission eigenchannels each for each disorder strength. For the classification, each intensity distribution from each of the transmission eigenchannels was assigned a port number from 0-9. Depending on the model, we represented the port number as either a single label encoding 0-9 or a one-hot vector encoding. The one-hot vector encoding was a 10-component vector representing the probability of the intensity distribution being produced by that port, where the correct port had a probability of 1.0 and all other ports had a probability of 0.0. As is typical when working with neural networks, we normalized the intensity distribution of the transmission eigenchannels of all the configurations by scaling them between 0.0 and 1.0. Figure 3a,b shows schematics of the architecture of the decision tree and neural network used in this work for the classification task. The dataset was split into 70% training data (525,000 intensity distribution-port pairs), 6% validation data (45,000 intensity distribution-port pairs), and 24% testing data (180,000 intensity distribution-port pairs). The training data were directly used to guide the improvement of the model over time. The validation data, which the model had not seen, gave an unbiased evaluation of the training; these data did not help improve the model but were used for selection of the best-performing model. After training, the testing data, which had not been previously run through the model, were used to evaluate the final model's accuracy. For each run, the training, validation, and test sets were randomly shuffled within their sets, ensuring that the model did not optimize training and testing for a particular subset of the data. Figure 2: Numerical simulation of disordered photonic structures: (**a**) Numerically calculated spatial profiles of cross-section averaged intensity (proportional to energy density) of transmission eigenchannels with the ten highest transmission eigenvalues of disordered structures with \(N_{s}\) = 300. The different spatial profiles of the different transmission eigenchannels are shown in different colors. The intensities were averaged over 10,000 different random configurations. \(T_{1}\) corresponds to the eigenchannel with the highest transmission eigenvalue; (**b**) Numerically calculated two-dimensional intensity distribution of the transmission eigenchannel with the highest transmission eigenvalue \(T_{1}\) for a single random configuration with \(N_{s}\) = 300; (**c**) Cross-section averaged intensity distribution (corresponding to the two-dimensional intensity distribution shown in (**b**)) overlaid on the spatial profiles of transmission eigenchannels \(T_{1}\) ( blue line) and \(T_{2}\) ( red line) (**a**); (**d**) Histogram of the root mean square deviation (RMSD) values of 5000 configurations of the transmission eigenchannels with the highest transmittance (Channel 1) and second-highest transmittance (Channel 2). Both histograms have very similar spread and shape. Partitioning the data in this way allowed us to ensure that the model was not memorizing the intensity distribution-port parings but rather learning relevant characteristics of the intensity distributions of the transmission eigenchannels to match them to the correct ports. To analyze how much data is needed to train a high-accuracy model, we also tried training the model on balanced subsets of the whole dataset from 100% of the data (750,000 intensity distribution-port pairs) to 10% of the data (75,000 intensity distribution-port pairs). The results are shown in the Section 3.