An Hierarchical Approach to the Segmentation of Residential Demand: Theory and Application