We present a data-driven method to estimate absolute magnitudes for O- and B-type stars from the LAMOST spectra, which we combine with Gaia DR2 parallaxes to infer distance and binarity. The method applies a neural network model trained on stars with precise Gaia parallax to the spectra and predicts K_s_-band absolute magnitudes M_Ks_ with a precision of 0.25mag, which corresponds to a precision of 12% in spectroscopic distance. For distant stars (e.g., >5kpc), the inclusion of constraints from spectroscopic M_Ks_ significantly improves the distance estimates compared to inferences from Gaia parallax alone. Our method accommodates for emission-line stars by first identifying them via principal component analysis reconstructions and then treating them separately for the M_Ks_ estimation. We also take into account unresolved binary/multiple stars, which we identify through deviations in the spectroscopic M_Ks_ from the geometric M_Ks_ inferred from Gaia parallax. This method of binary identification is particularly efficient for unresolved binaries with near equal-mass components and thus provides a useful supplementary way to identify unresolved binary or multiple-star systems. We present a catalog of spectroscopic M_Ks_, extinction, distance, flags for emission lines, and binary classification for 16002 OB stars from LAMOST DR5. As an illustration, we investigate the M_Ks_ of the enigmatic LB-1 system, which Liu et al. 2019Natur.575..618L had argued consists of a B star and a massive stellar-mass black hole. Our results suggest that LB-1 is a binary system that contains two luminous stars with comparable brightness, and the result is further supported by parallax from the Gaia eDR3.
Cone search capability for table J/ApJS/253/22/table1 (Distance catalog for 16002 OB stars in LAMOST DR5)