Analysis, modeling and optimization of residential energy use from smart meter data