Proper analysis of building energy performance requires selecting appropriate models for handling complicated calculations. Machine learning has recently emerged as a promising effective solution for solving this problem. The present study proposes a novel integrative machine learning model for predicting two energy parameters of residential buildings, namely annual thermal energy demand (DThE) and annual weighted average discomfort degree-hours (HDD). The model is a feed-forward neural network (FFNN) that is optimized via the electrostatic discharge algorithm (ESDA) for analyzing the building characteristics and finding their optimal contribution to the DThE and HDD. According to the results, the proposed algorithm is an effective double-target model that can predict the required parameters with superior accuracy. Moreover, to further verify the efficiency of the ESDA, this algorithm was compared with three similar optimization techniques, namely atom search optimization (ASO), future search algorithm (FSA), and satin bowerbird optimization (SBO). Considering the Pearson correlation indices 0.995 and 0.997 (for the DThE and HDD, respectively) obtained for the ESDA-FFNN versus 0.992 and 0.938 for ASO-FFNN, 0.926 and 0.895 for FSA-FFNN, and 0.994 and 0.995 for SBO-FFNN, the ESDA provided higher accuracy of training. Subsequently, by collecting the weights and biases of the optimized FFNN, two formulas were developed for easier computation of the DThE and HDD in new cases. It is posited that building engineers and energy experts could consider the use of ESDA-FFNN along with the proposed new formulas for investigating the energy performance in residential buildings.