Calculating similarity based on attributes
<p>My objective is to calculate the degree of similarity between two users based on their attributes. For instance let's consider a player and consider age, salary, and points as attributes. </p>

<p>Also I want to place weight on each attribute by order of importance. In my case age is a more important attribute than salary and points. So for instance let's assume we calculate the similarity using the euclidean distance. </p>

<pre><code>Given user 1 who is age 20, salary 50, points scored 100

Given user 2 who is age 24, salary 60, points scored 85

Given user 3 who is age 19, salary 62, points scored 80
</code></pre>

<p>To compute the similarity between user 1 and user 2 I could do</p>

<blockquote>
  <p>sqrt of( (20-24)^2 + (60-50)^2 + (85-100)^2 )</p>
</blockquote>

<p>Now we want to also add the weights so in euclidean distance the lower the number the more closer two objects are in terms of similaraity. As mentioned earlier since age is the most important so we will assign weights as follows</p>

<blockquote>
  <p>sqrt of( 0.60*(20-24)^2 + 0.20*(60-50)^2 + 0.20*(85-100)^2 )</p>
</blockquote>

<p>Is my approach correct ? Also should i be considering other algorithms such as cosine similarity to calculate similarity?</p>