This study presents a semi-analytical solution that can calculate the free vibration frequencies of functionally graded nanobeams with three distinct pore distributions under both deformable and rigid boundary conditions, based on nonlocal elasticity and Levinson beam theories. The novelty lies in the incorporation of transverse springs at both ends of porous functionally graded nanobeams and introducing a general eigenvalue problem dependent on the stiffness of these springs. This solution provides vibrational frequencies considering Levinson beam theory, non-local elasticity theory, spring stiffnesses, porosity coefficients, and temperature change. Additionally, the vibrational behavior of these porous nanobeams is explored through machine learning (ML) techniques. Four ML models namely artificial neural network (ANN), support vector regression (SVR), decision tree (DT), and extreme gradient boosting (XGB) are trained to predict the natural frequencies of nanobeams with varying pore distributions. The Sobol quasi-random space-filling method is employed to generate samples by altering input feature combinations for different porous nanobeam distributions. Model performance is evaluated using different performance indicators and visualization tools, with optimal hyperparameters determined via a Bayesian optimization algorithm. Results underscore the efficacy of ML models in predicting natural frequencies, with SVR and ANN demonstrating superior performance compared to XGB and DT. Notably, SVR and ANN exhibit exceptional R2 values of 0.999, along with the lowest MAE, MAPE, and RMSE values among the models assessed. At the end of the study, the effects of various parameters on porous gold (Au) nanobeams using the solution of the presented eigenvalue problem are discussed.