Determine similarity of a sequence of [-1, 1] pairs?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












Let's say there are 5 questions, and the answer to each one can be between -1 and 1.



Two people are answering these questions, so they each have a vector of their answers. Example:




[ -.3, 0, .95, -.94, .4 ]
[ .3, .7, .9, 1, -.3 ]



How do I find how similar they are in total? Probably as a single number representing their total answer similarity (-1 being complete opposite and 1 being the same?)



Is it just the dot product? Or is there another/better way?







share|cite|improve this question
























    up vote
    1
    down vote

    favorite












    Let's say there are 5 questions, and the answer to each one can be between -1 and 1.



    Two people are answering these questions, so they each have a vector of their answers. Example:




    [ -.3, 0, .95, -.94, .4 ]
    [ .3, .7, .9, 1, -.3 ]



    How do I find how similar they are in total? Probably as a single number representing their total answer similarity (-1 being complete opposite and 1 being the same?)



    Is it just the dot product? Or is there another/better way?







    share|cite|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      Let's say there are 5 questions, and the answer to each one can be between -1 and 1.



      Two people are answering these questions, so they each have a vector of their answers. Example:




      [ -.3, 0, .95, -.94, .4 ]
      [ .3, .7, .9, 1, -.3 ]



      How do I find how similar they are in total? Probably as a single number representing their total answer similarity (-1 being complete opposite and 1 being the same?)



      Is it just the dot product? Or is there another/better way?







      share|cite|improve this question












      Let's say there are 5 questions, and the answer to each one can be between -1 and 1.



      Two people are answering these questions, so they each have a vector of their answers. Example:




      [ -.3, 0, .95, -.94, .4 ]
      [ .3, .7, .9, 1, -.3 ]



      How do I find how similar they are in total? Probably as a single number representing their total answer similarity (-1 being complete opposite and 1 being the same?)



      Is it just the dot product? Or is there another/better way?









      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Aug 23 at 2:25









      Chron Bag

      83




      83




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          The most intuitive metric I can think of for this context is the Euclidean (i.e. sum of squares) distance between the vectors. That is, the distance between $(x_1,dots,x_5)$ and $(y_1,dots,y_5)$ is given by
          $$
          d = sqrtsum_k=1^5 (x_k - y_k)^2
          $$
          Notably, the least $d$ can be is $0$, and the most $d$ can be is $2 sqrt5$. If you'd like your measure to fall between $-1$ and $1$, you could define
          $$
          D = 1 - fracdsqrt5 = 1 - sqrtfracsum_k=1^5 (x_k - y_k)^25
          $$
          we will have $D = 1$ when the vectors are identical, and $D = -1$ when the vectors are "opposite".






          share|cite|improve this answer




















          • Thanks this helps a lot! I think this is what I'm looking for.
            – Chron Bag
            Aug 23 at 2:40










          • The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
            – Chron Bag
            Aug 23 at 2:44











          • You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
            – Omnomnomnom
            Aug 23 at 2:55










          • Cool thanks! (chars)
            – Chron Bag
            Aug 23 at 3:02










          • You're welcome!
            – Omnomnomnom
            Aug 23 at 3:03










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "69"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2891629%2fdetermine-similarity-of-a-sequence-of-1-1-pairs%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          The most intuitive metric I can think of for this context is the Euclidean (i.e. sum of squares) distance between the vectors. That is, the distance between $(x_1,dots,x_5)$ and $(y_1,dots,y_5)$ is given by
          $$
          d = sqrtsum_k=1^5 (x_k - y_k)^2
          $$
          Notably, the least $d$ can be is $0$, and the most $d$ can be is $2 sqrt5$. If you'd like your measure to fall between $-1$ and $1$, you could define
          $$
          D = 1 - fracdsqrt5 = 1 - sqrtfracsum_k=1^5 (x_k - y_k)^25
          $$
          we will have $D = 1$ when the vectors are identical, and $D = -1$ when the vectors are "opposite".






          share|cite|improve this answer




















          • Thanks this helps a lot! I think this is what I'm looking for.
            – Chron Bag
            Aug 23 at 2:40










          • The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
            – Chron Bag
            Aug 23 at 2:44











          • You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
            – Omnomnomnom
            Aug 23 at 2:55










          • Cool thanks! (chars)
            – Chron Bag
            Aug 23 at 3:02










          • You're welcome!
            – Omnomnomnom
            Aug 23 at 3:03














          up vote
          1
          down vote



          accepted










          The most intuitive metric I can think of for this context is the Euclidean (i.e. sum of squares) distance between the vectors. That is, the distance between $(x_1,dots,x_5)$ and $(y_1,dots,y_5)$ is given by
          $$
          d = sqrtsum_k=1^5 (x_k - y_k)^2
          $$
          Notably, the least $d$ can be is $0$, and the most $d$ can be is $2 sqrt5$. If you'd like your measure to fall between $-1$ and $1$, you could define
          $$
          D = 1 - fracdsqrt5 = 1 - sqrtfracsum_k=1^5 (x_k - y_k)^25
          $$
          we will have $D = 1$ when the vectors are identical, and $D = -1$ when the vectors are "opposite".






          share|cite|improve this answer




















          • Thanks this helps a lot! I think this is what I'm looking for.
            – Chron Bag
            Aug 23 at 2:40










          • The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
            – Chron Bag
            Aug 23 at 2:44











          • You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
            – Omnomnomnom
            Aug 23 at 2:55










          • Cool thanks! (chars)
            – Chron Bag
            Aug 23 at 3:02










          • You're welcome!
            – Omnomnomnom
            Aug 23 at 3:03












          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          The most intuitive metric I can think of for this context is the Euclidean (i.e. sum of squares) distance between the vectors. That is, the distance between $(x_1,dots,x_5)$ and $(y_1,dots,y_5)$ is given by
          $$
          d = sqrtsum_k=1^5 (x_k - y_k)^2
          $$
          Notably, the least $d$ can be is $0$, and the most $d$ can be is $2 sqrt5$. If you'd like your measure to fall between $-1$ and $1$, you could define
          $$
          D = 1 - fracdsqrt5 = 1 - sqrtfracsum_k=1^5 (x_k - y_k)^25
          $$
          we will have $D = 1$ when the vectors are identical, and $D = -1$ when the vectors are "opposite".






          share|cite|improve this answer












          The most intuitive metric I can think of for this context is the Euclidean (i.e. sum of squares) distance between the vectors. That is, the distance between $(x_1,dots,x_5)$ and $(y_1,dots,y_5)$ is given by
          $$
          d = sqrtsum_k=1^5 (x_k - y_k)^2
          $$
          Notably, the least $d$ can be is $0$, and the most $d$ can be is $2 sqrt5$. If you'd like your measure to fall between $-1$ and $1$, you could define
          $$
          D = 1 - fracdsqrt5 = 1 - sqrtfracsum_k=1^5 (x_k - y_k)^25
          $$
          we will have $D = 1$ when the vectors are identical, and $D = -1$ when the vectors are "opposite".







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Aug 23 at 2:34









          Omnomnomnom

          122k784170




          122k784170











          • Thanks this helps a lot! I think this is what I'm looking for.
            – Chron Bag
            Aug 23 at 2:40










          • The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
            – Chron Bag
            Aug 23 at 2:44











          • You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
            – Omnomnomnom
            Aug 23 at 2:55










          • Cool thanks! (chars)
            – Chron Bag
            Aug 23 at 3:02










          • You're welcome!
            – Omnomnomnom
            Aug 23 at 3:03
















          • Thanks this helps a lot! I think this is what I'm looking for.
            – Chron Bag
            Aug 23 at 2:40










          • The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
            – Chron Bag
            Aug 23 at 2:44











          • You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
            – Omnomnomnom
            Aug 23 at 2:55










          • Cool thanks! (chars)
            – Chron Bag
            Aug 23 at 3:02










          • You're welcome!
            – Omnomnomnom
            Aug 23 at 3:03















          Thanks this helps a lot! I think this is what I'm looking for.
          – Chron Bag
          Aug 23 at 2:40




          Thanks this helps a lot! I think this is what I'm looking for.
          – Chron Bag
          Aug 23 at 2:40












          The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
          – Chron Bag
          Aug 23 at 2:44





          The only other thing I am wondering is if there would be a way to make the equation more efficient (square roots are expensive!), although that might be another question. (It's going to be a bottleneck in a computer program most likely)
          – Chron Bag
          Aug 23 at 2:44













          You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
          – Omnomnomnom
          Aug 23 at 2:55




          You could always just use $$ D = 1 - fracsum_k=1^5 (x_k - y_k)^25 $$ This quantity doesn't correspond to the literal distance between vectors anymore so we lose some nice properties, but it does what you need it to do.
          – Omnomnomnom
          Aug 23 at 2:55












          Cool thanks! (chars)
          – Chron Bag
          Aug 23 at 3:02




          Cool thanks! (chars)
          – Chron Bag
          Aug 23 at 3:02












          You're welcome!
          – Omnomnomnom
          Aug 23 at 3:03




          You're welcome!
          – Omnomnomnom
          Aug 23 at 3:03

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2891629%2fdetermine-similarity-of-a-sequence-of-1-1-pairs%23new-answer', 'question_page');

          );

          Post as a guest













































































          這個網誌中的熱門文章

          tkz-euclide: tkzDrawCircle[R] not working

          How to combine Bézier curves to a surface?

          1st Magritte Awards