A data-driven approach to support the automation of thermostats in residential buildings