Energy consumption predictions for buildings play an important role in energy efficiency and sustainability research. Accurate energy predictions have numerous application in real-time performance monitoring, fault detection, identifying prime targets for energy conservation, quantifying savings resulting from energy efficiency projects, etc. Machine learning-based energy models have proved to be more efficient and accurate where historical time series data is available. This paper presents various machine learning concepts that will aid in the generation of more accurate and efficient energy models. We have shown in detail the development of energy models using extreme gradient boosting (XGBoost), artificial neural network (ANN), and degree-day-based ordinary least square regression. We have presented a thorough description of the workflow, including intermediate steps for feature engineering, feature selection, hyper-parameter optimization and the Python source code. Our results indicate that XGBoost produces highly accurate energy models, and the intermediate steps are particularly important for XGBoost and ANN model development.