# Finding the most representative row in a dataset

Our goal is to model the hourly electric usage of a building given only building characteristics. We are running hourly energy models on hundreds of thousands of virtual buildings. We then take a real building, with known building characteristics such as year built, square footage and many other attributes, and find all virtual buildings that match these characteristics. The more matching characteristics, the more accurate the model. There may be 40-400 matching virtual buildings per real building.

Every virtual building is unique. Unfortunately, we don't have enough matching criteria to always match a single virtual buidling to a real building. There will usually be multiple matching buildings. (There are reasons we don't model the real buildings directly)

For assigning the summed, yearly electric use to the real building, it's straightforward. Take the mean or mode of the yearly electric use of the matched set.

But what if we want to assign hourly electric usage from a virtual building to a real building? Let's say we match 40 virtual buildings to a real building. Of those 40, how do we pick the most "representative" virtual building in order to assign it's hourly electric usage to that real building? Representative could likely mean mode, but average may also work.

Taking each hour's average in a year and then assigning it seems wrong. I think we would have a smoothed function that doesn't represent a real building's load profile. Similarly, we can take the mode of each hour, but that also would create an unrealistic load profile.

What I think we want is to pick the most representative building in a matched set. With building characteristics all the same in a matched set, the only differentiator is the hourly electric use. But given ~40 sets of hourly electric data, each set having 8760 datapoints, how can we select the most representative one?

You already know how to atribute the summed, yearly electric use to the real building ; you are only interested in the hourly pattern of electric usage. So I assume you can standardize each hourly electric usage so that it becomes a distribution (i.e. which percentage of the electric usage was used before 8am ; 5pm ; 12pm).

Intuitively: You may choose a distance between distributions. Then for each of the 40 virtual buildings of a given set, you may compute for instance the sum of distances to all other 39 virtuals buildings in your cluster. The most representative point of the set would be the one minimizing its sum of distances.

This would be an equivalent of medians to distributions (considering that the median of a random variable X is the minimizer of the mean absolute error with respect to X)

A limits of the median quickly appears: there are obvious cases of equality, for instance in the case of only two virtual building. (you may select at random?)

But at least, you would opt for a real pattern, and not an average one.

• * Do we need to create a percentage of usage? The absolute value matters between buildings. For example, if two buildings use 10% of the energy at 8am, but one building uses 5kWh and the other building uses 10kWh, that's an important difference * When creating a distribution (8am, 5pm..) are you saying binning the hours in chunks? Or cumulative use every hour? Is this approach required to measure the distance between those distributions? We have important variations hourly and throughout a year. Assuming we have the compute power, could the distance be measured for every hour of the year?
– Jeff
Commented May 12, 2020 at 1:17
• Please note that i am not a specialist. My answer comes without guarantee. :) Commented May 12, 2020 at 5:59
• * Yes, but maybe this is not exactly appropriate and you have to refine the idea. By taking for instance the virtual building that minimizes the sum of square of 1. The difference between difference in total electric usage, 2. The difference in distribution in electric usage ? (I do not know if the comparison to the median still "holdzs") Commented May 12, 2020 at 6:03
• * whatever is needed for the distance between two distribution that you will choose and use. (I have seen there are several posts on the various distances that are available) Commented May 12, 2020 at 6:05