Solar photovoltaic (PV) systems, integral for sustainable energy, face challenges in forecasting due to the unpredictable nature of environmental factors influencing energy output. This study explores five distinct machine learning (ML) models which are built and compared to predict energy production based on four independent weather variables: wind speed, relative humidity, ambient temperature, and solar irradiation. The evaluated models include multiple linear regression (MLR), decision tree regression (DTR), random forest regression (RFR), support vector regression (SVR), and multi-layer perceptron (MLP). These models were hyperparameter tuned using chimp optimization algorithm (ChOA) for a performance appraisal. The models are subsequently validated on the data from a 264 kWp PV system, installed at the Applied Science University (ASU) in Amman, Jordan. Of all 5 models, MLP shows best root mean square error (
RMSE
), with the corresponding value of 0.503, followed by mean absolute error (
MAE
) of 0.397 and a coefficient of determination (
R
2
) value of 0.99 in predicting energy from the observed environmental parameters. Finally, the process highlights the fact that fine-tuning of ML models for improved prediction accuracy in energy production domain still involves the use of advanced optimization techniques like ChOA, compared with other widely used optimization algorithms from the literature.