Streptococcus pneumoniae is the most common human respiratory pathogen, and xcexb2-lactam antibiotics have been employed to treat infections caused by S. pneumoniae for decades. xcexb2-lactam resistance is steadily increasing in pneumococci and is mainly associated with the alteration in penicillin-binding proteins (PBPs) that reduce binding affinity of antibiotics to PBPs. However, the high variability of PBPs in clinical isolates and their mosaic gene structure hamper the predication of resistance level according to the PBP gene sequences. In this study, we developed a systematic strategy for applying supervised machine learning to predict S. pneumoniae antimicrobial susceptibility to xcexb2-lactam antibiotics. We combined published PBP sequences with minimum inhibitory concentration (MIC) values as labelled data and the sequences from NCBI database without MIC values as unlabelled data to develop an approach, using only a fragment from pbp2x (750 bp) and a fragment from pbp2b (750 bp) to predicate the cefuroxime and amoxicillin resistance. We further validated the performance of the supervised learning model by constructing mutants containing the randomly selected pbps and testing more clinical strains isolated from Chinese hospital. In addition, we established the association between resistance phenotypes and serotypes and sequence type of S. pneumoniae using our approach, which facilitate the understanding of the worldwide epidemiology of S. pneumonia.