  Background: $^{132}$Sn+$^{124}$Sn collisions at the beam energy of 270
MeV$/$nucleon have been performed at the Radioactive Isotope Beam Factory
(RIBF) in RIKEN to investigate the nuclear equation of state. Reconstructing
impact parameter is one of the important tasks in the experiment as it relates
to many observables. Purpose: In this work, we employ three commonly used
algorithms in machine learning, the artificial neural network (ANN), the
convolutional neural network (CNN) and the light gradient boosting machine
(LightGBM), to determine impact parameter by analyzing either the charged
particles spectra or several features simulated with events from the
ultra-relativistic quantum molecular dynamics (UrQMD) model. Method: To closely
imitate experimental data and investigate the generalizability of the trained
machine learning algorithms, incompressibility of nuclear equation of state and
the in-medium nucleon-nucleon cross sections are varied in the UrQMD model to
generate the training data. Results: The mean absolute error $\Delta b$ between
the true and the predicted impact parameter is smaller than 0.45 fm if training
and testing sets are sampled from the UrQMD model with the same parameter set.
However, if training and testing sets are sampled with different parameter
sets, $\Delta b$ would increase to 0.8 fm. Conclusion: The generalizability of
the trained machine learning algorithms suggests that these machine learning
algorithms can be used reliably to reconstruct impact parameter in experiment.
