Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have vectors of same length consisting of 1 and 0. I am trying to find out how similar they are. So far I am using hamming distance that I calculate sum of one vector then sum of second vector and the difference between this is the difference of the days. With 1 and 0 it works pretty well.

My problem is that it doesn't reflect in any way where is the difference in the vectors and what is the variance of the error. I have thought of counting of how many 1 been misplaced to 1 of the next vector and how many 0 have been misplaced. It gives little bit more of information but still doesn't tell anything about the variance of the error.

The vectors are used to represent occupancy of house in time, with every 1 indicating that house is occupied and 0 that it is not. From this I am trying to predict how next day will look.

I also found out that approach to compare vectors is not the best one but rather to find a trend across the vectors is the best way to create effective predictions.

Can you hint me which ways are there to tackle this?

share|cite|improve this question
up vote 1 down vote accepted

You could try Cosine similarity or the Jaccard index.

share|cite|improve this answer
A rule of thumb that I like to employ: if you've tried it and it works, give a suggestion as a hint in an answer. Otherwise, give a suggestion for a possible attack as a comment to the question. (Note: I am not saying whether this suggestion works or not.) – robjohn May 12 '13 at 15:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.