Machine-Learning Enhanced Photometric Analysis of the Extremely Bright GRB 210822A

We present analytical and numerical models of the bright long GRB 210822A at z = 1 . 736 . The intrinsic extreme brightness exhibited in the optical, which is very similar to other bright GRBs (e.g., GRBs 080319B, 130427A, 160625A 190114C, and 221009A), makes GRB 210822A an ideal case for studying the evolution of this particular kind of GRB. We use optical data from the RATIR instrument starting at T + 315 . 9 s, with publicly available optical data from other ground-based observatories, as well as X-ray data from the Swift /X-ray Telescope (XRT) and data from the Swift /Ultraviolet/Optical Telescope (UVOT). The temporal profiles and spectral properties during the late stages align consistently with the conventional forward shock model, complemented by a reverse shock element that dominates optical emissions during the initial phases ( T < 300 s). Furthermore, we observe a break at T = 80000 s that we interpreted as evidence of a jet break, which constrains the opening angle to be about θ j = (3 − 5) degrees. Finally, we apply a machine-learning technique to model the multi-wavelength light curve of GRB 210822A using the afterglowpy library . We estimate the angle of sight θ obs = (6 . 4 ± 0 . 1) × 10 − 1 degrees, the energy E 0 = (7 . 9 ± 1 . 6) × 10 53 ergs, the electron index p = 2 . 54 ± 0 . 10 , the thermal energy fraction in electrons ϵ e = (4 . 63 ± 0 . 91) × 10 − 5 and in the magnetic field ϵ B = (8 . 66 ± 1 . 01) × 10 − 6 , the efficiency χ = 0 . 89 ± 0 . 01 , and the density of the surrounding medium n 0 = 0 . 85 ± 0 . 01 .

The fireball model (Mészáros & Rees 1997;Granot & Sari 2002;Kumar & Zhang 2015) is the most successful theory for interpreting the electromagnetic radiation of GRBs.The model explains the observed prompt (gamma-ray) emission by internal shocks in the jet driven by a central engine (Sari & Piran 1997) and the late emission or afterglow by the existence of an external shock between the outflow and the circumburst medium (e.g., Sari et al. 1998;Granot & Sari 2002).The radiation process that dominates the afterglow is synchrotron emission, produced by relativistic electrons that are continuously accelerated by an ongoing shock interacting with the surrounding medium.This blast wave produces a forward shock that propagates into the surrounding medium and a reverse shock that propagates inward through the relativistic shell (Sari et al. 1998;Sari & Piran 1999).
For later times, a similar evolution of the X-ray and optical emission would be expected for a GRB (Kumar & Zhang 2015;Zhang et al. 2006).Nevertheless, there are numerous features that appear in optical that are not seen simultaneously in X-rays, such as the reverse shock component and early rebrightening (see e.g.Li et al. 2012;Becerra et al. 2023b).These features can suggest different characteristics, such as: the GRB origin being different, they are in a different spectral segment (Granot & Sari 2002), are produced by different components, or are produced in a more complex environment (see e.g.Gao & Mészáros 2015).
Bright GRBs permit follow-up for a longer period of time (see e.g.O'Connor et al. 2023;Becerra et al. 2023aBecerra et al. , 2019a)), leading to a better understanding of their progenitors and circumburst environments.Given that only about 40% of these phenomena have a well-determined distance (Evans et al. 2007(Evans et al. , 2009)), the study of particularly bright GRBs with known distances is extremely valuable because they allow us to explore in more detail the morphology and structure of the jet (see e.g.Gill et al. 2019).
Here, we present photometric observations of the long GRB 210822A in the optical, UV, and X-rays during the afterglow phase and compare them with the detailed predictions of the fireball model.
Our paper is organised as follows.In Section 2, we present observations with Swift, RATIR, Katzman Automatic Imaging Telescope (KAIT), the Nordic Optical Telescope (NOT), and other ground-based telescopes.In Section 3 we present our analysis.We discuss the nature of the GRB 210822A and its interpretation within the context of the current fireball model, and we conduct a comparative analysis of our photometry with other events and deduce the physical parameters that could describe this explosion in Section 4. Finally, we provide a summary of our results in Section 5.

High-energy
The Swift/BAT instrument triggered on GRB 210822A at T = 2021 August 22 09:18:18 UTC (Page et al. 2021).The Swift/BAT on-board location was 20:17:50.7 +05:15:54.9J2000, with an uncertainty of 3.0 arcmin (radius, 90% containment, including systematic uncertainty).The Swift/BAT mask-weighted light curve showed a multi-peaked structure that started and peaked at the time of trigger (T ).The main pulse structure ended at about T + 20 s, followed by a long tail that lasted until about T + 400 s.The duration of GRB 210822A (15-350 keV) was T90 = 185.8± 46.6 seconds, making it a long GRB, with an estimated fluence of 2.0±0.04×10−6 erg cm −2 in the 15-150 keV band (Lien et al. 2021).We investigate the similarities of GRB 210822A with previous Swift/BAT events (Evans et al. 2007(Evans et al. , 2009)), in order to identify other similar phenomena using a machine learning approach.The method and results are presented in Section 4.2.1.
The Konus-Wind instrument reported observations starting at about T − 1 s and with a total duration of about 12 s.According to Frederiks et al. (2021), the burst had a fluence of 1.20 ± 0.11 × 10 −4 erg cm −2 and a 64 ms peak flux, measured from T + 0.320 s, of 3.25 ± 0.28 × 10 −5 erg cm −1 (both in the 20 keV to 10 MeV energy range).
The Swift/X-ray Telescope (XRT) instrument started observing the field at T + 74.6 s and found an uncatalogued X-ray source at 20:17:45.01+05:17:00.6J2000 with an uncertainty of 2.0 arcsec (radius, 90% containment).Its location, only 145 arcsec from the Swift/BAT on board position (Page et al. 2021), was well inside the Swift/BAT error circle.
Finally, the Swift/Ultra-violet Optical Telescope (UVOT) instrument began settled observations of the field of GRB 210822A at T + 85 s, detecting a fading source consistent with the Swift/XRT position (Siegel et al. 2021).Swift/UVOT took a finding chart exposure of 250 seconds with the u filter starting at T + 295 s (Page et al. 2021).The afterglow candidate was found in the initial data products in all filters.

RATIR
The Reionization and Transients InfraRed camera (RATIR) 1 is a four-channel simultaneous optical and near-infrared imager.It was mounted on the 1.5 meters Harold L. Johnson Telescope at the Observatorio Astronómico Nacional in Sierra San Pedro Mártir in Baja California, Mexico, until summer 2022.RATIR autonomously responded to GRB triggers from the Swift satellite and obtained simultaneous photometry in riZJ or riY H bands (Butler et al. 2012;Watson et al. 2012;Littlejohns et al. 2015;Becerra et al. 2017).The reduction pipeline performed bias subtraction and flat field correction, followed by astrometric calibration using astrometry software (Lang et al. 2010), iterative sky subtraction, co-addition using SWARP, and source detection using sextractor (Bertin & Arnouts 1996;Becerra et al. 2017;Pereyra et al. 2022).We calibrated against the U.S. Naval Observatory B1 catalogue (USNO-B1) (Monet et al. 2003) and the Two Micron All-Sky Survey (2MASS) (Skrutskie et al. 2006).
RATIR observed the field of GRB 210822A from 2021 August 22 09:19:30 to 09:48:54 UTC (from T + 0.02 to T + 0.49 hours after the BAT trigger), obtaining a total of 0.19 hours of exposure in the r and i bands (Butler et al. 2021).RATIR obtained individual frames of 80 s of exposure time.RATIR photometry is presented in Table 1, as magnitudes in the AB system and without correction for the Milky Way extinction in the direction of the burst, and shown in Figure 1.

Other optical ground-based facilities
We complement RATIR photometry with data from other optical telescopes from the GCN/TAN circulars, such as the 0.76 m Katzman Automatic Imaging Telescope (KAIT) (Zheng et al. 2021), the NEXT-0.6 m telescope (NANSHAN) (Fu et al. 2021), the Nordic Optical Telescope (NOT) (Zhu et al. 2021), the Gamma-Ray Burst Optical/Near-Infrared Detector (GROND) (Nicuesa Guelbenzu et al. 2021), the Tian Shan Astronomical Observatory (TSHAO) (Belkin et al. 2021a), the Calar Alto Astronomical Observatory (CAHA) (Kann et al. 2021) and the 0.35 m telescope at the Abbey Ridge Observatory (Romanov & Lane 2021).This photometry is listed in Table 1 and shown in Figure 1.Zhu et al. (2021) estimated a redshift of z = 1.736 for the GRB 210822A using spectroscopic observations with NOT in the 3700 − 9500 Å range that showed a continuum with absorption characteristics from the Fe ii, Mg ii, Mg i and Al iii lines.
Additionally, Page et al. (2021) and Siegel et al. ( 2021) reported a reddening of E(B − V ) = 0.162 in the direction of the burst.We calculate the extinction Ar, adopting the relationship AV = 3.1×E(B − V ) (Schlegel et al. 1998) and Ar/AV ≈ 0.9 (Gordon et al. 2003).

TEMPORAL AND SPECTRAL ANALYSIS
In the framework of the fireball model, the afterglow phase is explained as synchrotron radiation from a population of accelerated electrons N with a power-law energy distribution N (E) ∝ E −p , where E and p are the energy and index respectively.Typically, the observed flux density Fν has a multisegmented power-law profile in both time t and frequency ν, denoted as Fν ∝ t −α ν −β (Sari et al. 1998;Granot & Sari 2002).

Temporal Analysis
Figure 1 shows the best fit to our optical photometry.Our data, in both filters, are well-modelled by one single power law segment for times between T + 300 s a T + 80000 with a power law Fν ∝ t −1.10±0.01 .This finding is in good agreement with the average decay index observed in large samples of GRB afterglows (Liang et al. 2010;Oates et al. 2009) and is consistent with an isotropic forward shock in a constantdensity medium.However, we note that for early times our photometry in the r band is better fit when a reverse-shock component is considered.(The data in the i band do not extend to such early times, but are also consistent with a reverse shock.)For a detailed discussion on the temporal evolution of the afterglow we refer to Sections 3.1.1and 4.1.

Early Afterglow
Figure 1 shows the best fit to our photometry.Both optical filters are well-modelled by one single power law segment for times after T + 300 s.We observe that for early times (T < 300 s), the photometry in the r band lies above our fit.To address this discrepancy, we fit these points independently using a distinct power law (depicted by the red dotted line in Figure 1).We consider a function Fν ∝ t −2 according to the anticipated decay pattern of a reverse shock component (Gao & Mészáros 2015), obtaining a better match to our photometry.We interpret this feature as the signature of the reverse shock propagating in the inner shell of the relativistic jet present in GRB 210822A (Sari & Piran 1999;Becerra et al. 2019a,b;Gomboc et al. 2009;Mészáros & Rees 1999).The presence of a reverse shock suggests the presence of a matterdominated shell, which implies a low level of magnetisation (Zhang & Kobayashi 2005;Zhang & Yan 2011;García-García et al. 2023).

Spectral Analysis
In order to complement our photometric analysis, we retrieved light curves and spectra from the UK Swift Science Data Centre (UKSSDC) online repository (Evans et al. 2009) in the range of 0.3-10 keV.We binned all data retrieved from Swift/XRT, for Window Timing and Photon Count modes independently (see Evans et al. 2007), considering groups of 3 consecutive exposures, which yields a variable size for the time bins.From T + 78 s to T + 1300 s, early times, bin sizes are around 1 to 7 s.The size bin increases significantly to tens or even hundreds of seconds for the late time observations, from T + 4500 s to T + 502000 s, where data are sparse.
The optical and X-ray data at T + 500 and T + 43000 s are well-fitted with a simple absorbed power law of slope β = −0.77± 0.03 (see Figure 2), which indicates that they belong to the same spectral segment.Fν ∝ ν −0.77±0.03yields an electron index of p = 2.54 ± 0.10 for GRB 210822A, and implies a value of Fν ∝ t −1.15±0.06 that is consistent with the temporal decay found in Section 3.1.Compared to the expected afterglow spectrum detailed in Granot & Sari (2002), we identify this segment as the frequency interval where νm < νopt < νX < νc.
Figure 2 also shows the fit of the model xspec that considers the effects of reddening and absorption by dust (Arnaud 1996).We performed our analysis at T + 500 s and T + 43000 s to compare the evolution of the SED.We used a reddening of E(B − V ) = 0.162 (Page et al. 2021), a redshift of z = 1.786 (Zhu et al. 2021), and a column density of 1.45 × 10 21 cm −2 (Perri et al. 2021).We obtained reduced χ 2 = 3.07 and χ 2 = 0.92 with 698 and 300 degrees of freedom, at T + 500 s and T + 43000 s, respectively.

Machine Learning Method
Machine learning (ML) has found diverse applications within astrophysics, spanning from exoplanet identification (Malik et al. 2021) and galaxy categorisation (Ferreira et al. 2020) to supernova classification (Lochner et al. 2016), spectral modelling (Vogl et al. 2020), and gravitational wave detection (Ni 2016).It is worth noting that the majority of these applica- tions consider ML for classification purposes, with limited utilisation in modelling.
Based on the results obtained in the Section 3.2, we plot in Figure 3 the light curves in the r and i bands by scaling the optical flux to a common frequency of 1 keV, considering ν −0.77 , and employ ML methodologies to build a predictive model for the afterglow of GRB 210822A.
Details of this implementation are described in Appendix A. To effectively train and evaluate the ML model, we generate synthetic light curve data with the afterglowpy library (Ryan et al. 2020).This synthetic data set is then used to train the ML model built in the Keras and Tensor-Flow libraries, as referenced in Chollet (2015), which subsequently processes the actual observational photometric data from Table 1 to extract the parameters that align with the prediction of the model, introducing a novel and unprecedented approach in the field.
We created a diverse data set comprising 30,000 synthetic GRB light curve models.These models included values of random parameters within predefined ranges for the angle of view θ obs , the energy E0, the opening angle θj, the electron index p, the thermal energy fraction in electrons ϵe and in the magnetic field ϵB, efficiency χ, and the density of the sur-rounding medium n0 (Sari et al. 1998;Granot & Sari 2002).These parameters are listed in Appendix A1.
The trained ML model was evaluated with observed GRB data, corrected by Galactic extinction, producing the parameter estimates shown in Table 2.The results of the optimal parameters applied to afterglowpy can be seen in Figure 3.
Nevertheless, we note that a machine learning method such as the one employed in the fit presented in Figure 3, inherently selects a single set of parameters.The 1σ error region is used to illustrate how well the best model fits the data, for the selected parameters (see details in Appendix A).As discussed by Garcia-Cifuentes et al. (2023a), in several adjustment methods, to find degeneracy in the parameters is not unusual.Such is the case of the relationship (scaling function) found between E0, n0 and ϵB depending on the value of p, in the same spectral regime for the afterglow (van Eerten & MacFadyen 2012;Granot 2012;Garcia-Cifuentes et al. 2023a).Thus, the photometry of the GRBs can be reproduced by a range of values given their energy, density and microphysical parameters.  .SED of GRB 210822A at T +500 s (red) and T +43000 s (gray).We use optical data from Table 1 and Swift/XRT data retrieved from the UKSSDC.We show the corresponding Xspec model (continuous lines), which considers the effects of reddening and absorption by the dust, as well as the linear fit (dashed lines).

Jet break
From Figure 3, we suggest the presence of a jet break between T + 80000 s and T + 100000 s (0.93-1.16 days).Considering this scenario, the opening angle for a constant density ISM depends on the jet break time as: where, EK,iso is the isotropic kinetic energy of the blast wave and n refers to the density of the circumburst medium (Wang et al. 2018).Assuming typical values of n0 = 0.85 cm −3 (see Section 3.3) and EK,iso=10 53 -10 55 erg, and the measured value of z = 1.74, we obtain an opening angle of the jet θj = 3-5 ± 0.5 degrees.Our estimated opening angle is consistent with the lower limits for the existing GRB sample (Berger 2014) and in good agreement with the value obtained from machine-learning modelling in Section 3.3.

Gamma-rays
The classification of extremely bright LGRBs is essential for understanding their nature and origin.Recently, machinelearning methods provide a faster and more consistent way to classify transients and, specifically, GRBs, by automatically learning from the data and identifying patterns that may be difficult for humans to detect.Furthermore, machine-learning methods can handle large amounts of data, including multiwavelength and multi-messenger observations, which are crucial for a comprehensive understanding of GRBs (see e.g.Jespersen et al. 2020;Garcia-Cifuentes et al. 2023b;Steinhardt et al. 2023).
Therefore, following the method presented by Garcia-Cifuentes et al. (2023b) using the ClassiPyGRB library2 .We analyse the Swift/BAT catalogue in order to find those GRBs whose gamma-ray emission measured by the Swift/BAT instrument are similar to GRB 210822A.This method is based on a popular non-linear dimensionality algorithm called t-SNE, which transforms high-dimensional data • The light curves binned at 64 ms are filtered using the T100 duration presented in the Swift/BAT GRB catalogue.
• We normalised the light curves by the total fluence and ensured that every GRB has the same number of data points by padding zeros after the trigger in all bands.
• We perform a discrete-time Fourier transform (DTFT) on all events.
• We applied the t-SNE method to the Fourier Amplitude Spectrum for the entire sample.
In Figure 4 we show all Swift/BAT GRBs on the t-SNE map.In this lower-dimensional plane, points that are closer to each other have more similarities in their original data than points that are further apart.This means that t-SNE maps provides a visual representation of the whole dataset, where the relative distances in the parameter space encode the relationships and similarities between the Swift/BAT light curves of the GRBs, allowing an intuitive understanding of their patterns in the dataset (van der Maaten & Hinton 2008).In the t-SNE plot, we constrain the neighbourhood of GRB 210822A to a circle subtended by the radius that contains the five closest data points. 3.The blue circle in the inset of Figure 4 indicates this region, and the nearest neighbors to GRB210822A are also listed (GRB050128, GRB080605, GRB080319C, GRB121128A, and GRB140428).We present some of their physical properties in Table 3.
In the next Section, we investigate the similarities in the optical counterpart and we will compare the events that are similar in that band with the set of similar GRBs in gammarays presented in this section and the implications of our results.

Optical
In the left panel of Figure 5, we compare the photometry of GRB 210822A in the v filter obtained by the Swift/UVOT instrument (Siegel et al. 2021) with the current sample of remarkably bright long GRBs with Swift/UVOT light curves, presented by Oates (2023).This sample includes GRBs with unusual behaviour such as the ultra-bright GRB 061007, GRB 080319B, GRB 081203A, GRB 130427A, GRB 160625B, GRB 190114C, and GRB 221009A, all of which are classified as spectacular GRBs in terms of their brightness, when compared with other 56 UVOT-observed GRBs discovered between 2005 and 2010 (Oates et al. 2012).
We look at the r band photometry for the same set of GRBs, presented in the left panel of Figure 5.We use the data from Mundell et al. (2007)  According to Figure 5, it can be seen that GRB 210822A has many similarities with the population of intrinsically bright GRBs (with Eiso ∼ 10 54 erg), sharing not only qualitative similarities in their temporal evolution, such as the observed slope and fluxes, but also their low redshift and opening angle θj (see Table 4).Moreover, GRB 210822A shares the presence of a reverse shock component with GRB 080319B (Bloom et al. 2009), GRB 130427A (Perley et al. 2014), GRB 160625B (Zhang et al. 2018;Fraija et al. 2017), GRB 190114C (Laskar et al. 2019;Fraija et al. 2019) and GRB 221009A (Laskar et al. 2023;Zhang et al. 2023;Bright et al. 2023;Gill & Granot 2023).
It is important to note that none of these events share a significant gamma-ray brightness, as discussed in detail in Section 4.2.1.This suggests that the optical emission and the gamma ray emission have different origins.Moreover, this illustrates the need to make multi-frequency observations for a complete understanding of each GRB.
The information provided in Table 4 suggests that GRB 210822A and the extremely bright optical LGRBs considered in this work, share an intrinsically high isotropic energy (Eiso) and luminosity (Liso).This, combined with the similarity found in their optical photometry, leads us to assume i) more extreme central engine properties which are https://swift.gsfc.nasa.gov/results/batgrbcat/summary_cflux/summary_general_info/summary_general.txtthought to originate from a binary-driven hypernova produced by a binary system composed of a carbon-oxygen star and a neutron star unlike the conventional GRBs (Rueda et al. 2020) or, ii) a specific configuration for the observer of a structured jet (Lan et al. 2023).
That said, Lan et al. (2023) compared the host galaxies of these intense GRBs with more conventional LGRBs and examined the energy, and they revealed no significant differentiation between these event groups.
The most accepted scenarios discussed for progenitors of LGRBs are a rapidly accreting black hole (BH, Narayan et al. 1992;Woosley 1993;Fryer et al. 1999) and a rapidly spinning, strongly magnetised neutron star (NS) (a millisecond magnetar; Duncan & Thompson 1992;Usov 1992;Thompson 1994).In the first scenario, the collapse of massive stars typically leads to a BH plus a long-lived debris torus system (e.g., see Woosley 1993).The relativistic jet is powered by extraction mediated by accretion from a Kerr BH (Blandford & Znajek 1977).When the star collapses into a BH, the stellar core must retain enough angular momentum to spin fast enough to generate an accretion disk.In the last scenario, a millisecond magnetar is generated with a large rotational energy to impede the gravitational collapse (e.g., see Metzger et al. 2011).The relativistic outflow is powered by the spindown luminosity of the magnetic dipole, and the maximum energy reservoir becomes ≈ 2×10 52 erg M 3 2 nsP −2 −3 with Mns the mass of the NS and P the corresponding spin period.Multiwavelength afterglow observations during the early phases provide valuable insights into elucidating the characteristics of the progenitors, the mass-loss evolution, metallicity, and establishing limits on the density of the surrounding medium (Ackermann et al. 2013;Fraija et al. 2019Fraija et al. , 2020)).For instance, metallicity plays a relevant role in wind mass loss, along with rotation, determining the final phase angular momentum and, therefore, the destiny of the massive star.A millisecond magnetar can hardly explain a burst with isotropic energy larger than 10 53 erg and disfavor bursts that exhibit an optical flare due to a large magnetisation that would suppress the reverse shock (e.g., see Zhang & Kobayashi 2005).Otherwise, highly bright LGRBs favour massive star progenitors with low metallicity (Perley et al. 2014;Zhang et al. 2018).

CONCLUSIONS
We have presented optical photometry of the afterglow of the ultra-bright GRB 210822A, combining new data from the RATIR instrument from T + 0.02 to T + 0.49 hours after the Swift trigger and with photometry from other telescopes published in GCN/TAN alerts.
We have compared the optical light curve and the X-ray obtained from Swift/XRT and Swift/UVOT, respectively.The photometric data reveal an achromatic temporal evolution well modelled by the expected evolution of an afterglow.The spectral indices measured at T + 500 and T + 43000 suggest the spectral regime where νm < νopt < νX < νc corresponds to a flux evolving as with p = 2.54 ± 0.10.Furthermore, we identified a reverse shock component in the optical bands before T + 300 s.We also see a change in slope between T + 80000 s and T + 100000 s that we interpret  2023)).Left: Optical light curves in the observer's frame with the Swift/UVOT instrument in the V band.We plot a power-law segment that illustrates the typical decay of α UVOT = 1.1.Right: Optical light curves of the same set of GRBs and placed at their corresponding rest frame.We complement the sample with the GRBs with known redshift presented in Becerra et al. (2023b).
In a general context, we showed the similarity of GRB 210822A with other events that are extremely bright in the optical/UV such as GRB 080319B, GRB 160625A GRB 190114C, GRB 221009A and GRB 130427A, which allows us to place GRB210822A in a peculiar group of GRBs with remarkably bright afterglows.Nevertheless, this set of GRBs differs from the events that share features in gammarays, evidencing the different regions and emission processes in which each of these frequencies originate.
Finally, we underscore the importance of early-to-late ground-based telescope observations following a trigger, coupled with the essential supplementation of optical photometry data from Swift/XRT and Swift/UVOT.This combined approach is indispensable to achieve a comprehensive understanding of the GRB phenomena.Using earlier observations, we were able to model the reverse shock component and determine the level of low magnetisation present in this GRB.On the other hand, later observations constrain the opening angle and, therefore, the geometry of the jet, providing us with clues about the type of progenitor that produced GRB 210822A.

APPENDIX A: NEURAL NETWORK IMPLEMENTATION
In this study, we presented a machine learning approach that harnesses the power of 30,000 synthetic GRBs models to automatically generate models from observational data.While the generation of these synthetic datasets may be timeintensive, the training of our machine learning model is remarkably efficient.Furthermore, the application of the model to new observational data is even faster.A noteworthy advantage of this methodology is its versatility, as the trained ML model can be applied to a wide range of observational data, provided that the GRB models in question fall within the parameter space covered by the 30,000 synthetic models.This approach offers a powerful and expedient tool for modeling and analyzing GRBs, with the potential to significantly accelerate research in this field.The implemented neural network architecture consists of a deep feedforward neural network with distinct layers.It incorporates multiple hidden layers and follows a pattern of stacking fully connected (dense) layers with activation functions, including ReLU and linear.Dropout layers are incorporated at various points within the architecture, serving as a form of regularisation to mitigate the risk of overfitting.
The final layer produces the output of the network output, producing predictions based on the initial input.This architecture allows the network to learn and model complex relationships within the data, contributing to its predictive capabilities.The idea is that we train the code with synthetic light curves as inputs and the eight parameters as outputs, so we can use the trained model to find parameters based on observed light curves.
The ML model was trained over a span of 14 epochs (Figure A1).The number of training epochs is automatically determined through the implementation of an early stopping mechanism, the EarlyStopping function 5 .This mechanism monitors the training process and stops training when convergence is detected in the loss function, facilitating efficient training by preventing overfitting and unnecessary iterations.The dataset was partitioned into three distinct sets: the training data, consisting of 25000 synthetic data points; the validation data, comprising 3000 samples; and the test data, with a total of 2000 samples.During each epoch, the ML model attempted to validate its learning by comparing its predictions against the validation dataset, which is not used in the training process.The primary objective of the training process is to minimise the loss function, the Mean Squared Error (MSE).
Once the model is adequately trained, it is evaluated against the test data set, which is used to estimate the errors in the parameters and to verify the absence of overfitting, which would restrict the neural network to reproducing only the training and validation data.Figure A1 presents the temporal evolution of the loss function for both training and validation data.

Figure 1 .
Figure1.Optical light curves of GRB 210822A.The red and gray symbols correspond to data in the r and i bands, respectively.Different symbols indicate data from RATIR (squares), KAIT (upward triangles), GROND (pentagons), NOT (crosses), TSHAO (pluses), CAHA (stars), and Abbey Ridge (diamonds).We illustrate the reverse shock (dotted line) and forward shock (dashed line) components that best fit the optical observations, as well as the sum of both (continuous line), for both the r and i bands.The temporal slopes that better describe the forward shock emission during the afterglow are also shown.The evolution of the light curve after T + 80000 s is discussed in Section 4.1

Figure 2
Figure2.SED of GRB 210822A at T +500 s (red) and T +43000 s (gray).We use optical data from Table1and Swift/XRT data retrieved from the UKSSDC.We show the corresponding Xspec model (continuous lines), which considers the effects of reddening and absorption by the dust, as well as the linear fit (dashed lines).

Figure 3 .
Figure3.X-ray and optical light curves of GRB 210822A.Optical photometry is re-scaled to a common frequency of 1 keV by employing the scaling ν −0.77 obtained in Section 3.2.We illustrate the model of the light curve of GRB 210822A using ML (dashed black line) and the 1σ error region (shaded magenta area).The parameters of our best fit are listed in Table2.

Figure 4 Figure 5 .
Figure 4. t-SNE visualization of the Swift//BAT data light curves using the method described by Garcia-Cifuentes et al. (2023b).The light curve obtained in the four bands of GRB 210822A by Swift/BAT in its automatic reduction pipeline is illustrated in the left panel.The blue circle indicates the equidistant region where the 5 closest events to GRB 210822A are located.

5Figure A1 .
Figure A1.Temporal evolution of the loss function for training (blue) and validation data (red)

Table 2 .
Parameter Values and Errors
* Fermi/GBM GRB as the signature of a jet break, allowing us to estimate a jet opening angle of about θj = 3 − 5 • .

Table A1 .
Interval of each parameter used in the synthetic data generation.