0
$\begingroup$

If I have various values, $x,\, y,\, z,\, t$. And I want to give each of these values a weight such as $x(30),\,y(10),\,z(40),\,t(20)$. This weight relates to that values part off $100\%$, so if each value was the most it could be and we added all values it would be 100. How can I make this type of equation ? for example in the event that $x$ was $50\% x = 30$, y was $100\%y = 10$, and $z$ and $t$ are $50\%$ I could get a score of $80$.

So basically I want the answer to be a value less or equal to $100$ were the values that are added to get the score are weighted and take up different portions of the overall score.

$\endgroup$

1 Answer 1

0
$\begingroup$

If you split a number $s$ into 4 parts with relative proportions $x:y:z:t$ you get $\frac{xs}{x+y+z+t}$, $\frac{ys}{x+y+z+t}$, $\frac{zs}{x+y+z+t}$, and $\frac{ts}{x+y+z+t}$.

Let's check this is correct:

It is obvious that these numbers are simply $x,y,z,t$ multiplied by $\frac{s}{x+y+z+t}$, so they have the right proportions. Their sum is $\frac{xs+ys+zs+ts}{x+y+z+t} = \frac{(x+y+z+t)s}{x+y+z+t} = s$ as required.

$\endgroup$
3
  • $\begingroup$ I think this is a bit different to what I need ill try to explain better. I have four independent values, I want to add these values and get a final value from 0 - 100. But I want the different values to have different weightings. So I want for instance the first value to make up 30% of the final value, the second to make up 20% and so on. $\endgroup$
    – dmnte
    Nov 29, 2017 at 4:04
  • $\begingroup$ @dmnte Are these four independent values also in the range 0-100? If so, just take their weighted average: $(w_1x+w_2y+w_3z+w_4t)/(w_1+w_2+w_3+w_4)$. If not, you'll have to scale those independent values first to make them fall in that 0-100 range before taking the weighted average.. $\endgroup$ Nov 29, 2017 at 7:47
  • $\begingroup$ After a little searching ive found the softmax function which seems like I could use. It is not weighted but I assume I could add this. Does anyone know anyreasons why this wouldnt be good ? $\endgroup$
    – dmnte
    Nov 30, 2017 at 1:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .