  Although red clump (RC) stars are easy to identify due to their stability of
luminosity and color, about 20-50% are actually red giant branch (RGB) stars in
the same location on the HR diagram. In this paper, a sample of 210,504 spectra
for 184 318 primary RC (PRC) stars from the LAMOST DR7 is identified, which has
a purity of higher than 90 percent. The RC and the RGB stars are successfully
distinguished through LAMOST spectra(R~1800 and SNR>10) by adopting the XGBoost
ensemble learning algorithm, and the secondary RC stars are also removed. The
SHapley Additive exPlanations (SHAP) value is used to explain the top features
that the XGBoost model selected. The features are around Fe5270, MgH & MgIb,
Fe4957, Fe4207, Cr5208, and CN, which can successfully distinguish RGB and RC
stars. The XGBoost is also used to estimate the ages and masses of PRC stars by
training their spectra with Kepler labeled asteroseismic parameters. The
uncertainties of mass and age are 13 and 31 percent, respectively. Verifying
the feature attribution model, we find the age-sensitive elements XGBoost gets
are consistent with the literature. Distances of the PRC stars are derived by
$K_{S}$ absolute magnitude calibrated by Gaia EDR3, which has an uncertainty of
about 6 percent and shows the stars mainly locate at the Galactic disk. We also
test the XGBoost with R$\sim$250, which is the resolution of the Chinese Space
Station Telescope(CSST) under construction, it is still capable of finding
sensitive features to distinguish RC and RGB.

Solar and Stellar Astrophysics;Astrophysics of Galaxies;Instrumentation and Methods for Astrophysics