Solar energy is highly unstable. Total photovoltaic energy generated varies based on changes in weather, climate and seasons. Owing to the arbitrariness of solar energy, photovoltaic output is prone to frequent power oscillations. Due to this reason, photovoltaic power prediction becomes obligatory. Through comprehensive analysis and critical examination, this research endeavours to shed light on the pursuit with regard to embracing solar energy as a sustainable channel of power generation. Additionally, the study aligns with the United Nations’ commitment on achieving the Sustainable Development Goals. The objective of this study is to prognosticate the electricity output from photovoltaic panel through compilation of meteorological parameters and computation of hourly global solar radiation upon an inclined surface, alongside the resultant energy yield from an inclined photovoltaic panel. This prediction is executed through the deployment of four optimized machine learning methods, specifically Support Vector Machines, Ensemble of Trees, Gaussian Process Regression and Neural Networks. Bayesian Optimization is utilized to optimize the machine learning models by tuning its hyperparameters. The analysis is conducted across three distinct dataset classifications: annual, monthly and seasonal. The empirical findings underscore that optimized Ensemble of Trees exhibits superior performance across all dataset classifications and also necessitates shortest training duration compared to its counterparts.