0

If there's a number series as so: 11.5, 6.7, 3.2, and 5.11

How does one convert these numbers into probabilities so that the sum of the resultant probabilities is 1?

Thank you.


What if the number series also includes negative numbers: -1.2, -100.34, 3.67, and 2.1 ?

Yes, they are weights associated with 4 possible classes for an instance.


ok. Here's my solution. Feel free to suggest improvements if any.

1) shift the range of numbers to be between 1 to any n(I choose 100) by method.

2) use the solution listed in answers.

The reason for choosing the lower bound as 1 in step 1) is to not loose the min value after applying the range conversion formula.

Solved Example:

Say there 2 instances that can take on 2 possible class values with weights as shown below.
Instance1: -11.0  -2.0
Instance2: 4.0    52.0

old_max = 52.0, old_min = -11.0, new_max = 100, and new_min = 1

After applying step1), the weights are now in range 1 to 100.
Instance1: 1       15.1
Instance2: 24.5    100    

On applying step2), the following probabilities are obtained.
Instance1: 0.0708   0.937
Instance2: 0.19     0.803
Community
  • 1
  • 1
leba-lev
  • 2,788
  • 10
  • 33
  • 43
  • 1
    Add all of them and then divide each of them by the sum ! – AllTooSir Jul 29 '13 at 15:46
  • 1
    What do the input numbers represent? It's possible that you just need to normalize them (as most answers are suggesting), or maybe not. – Daniel Earwicker Jul 29 '13 at 15:50
  • The input numbers represent weights with which an instance belongs to a particular class. Just for additional information: it's classification output from the svm_multiclass program. – leba-lev Jul 29 '13 at 15:55

2 Answers2

2

You can divide each number by the sum:

double arr[] = {11.5, 6.7, 3.2, 5.11};
double total = 11.5 + 6.7 + 3.2 + 5.11;
for (int i = 0; i < arr.length; i++) {
    System.out.println(arr[i] / total);
}

This works because the sum divided by the sum is 1.

jh314
  • 27,144
  • 16
  • 62
  • 82
2

A weighted sum?

x1= 11.5, x2 = 6.7, x3 = 3.2, x4= 5.11
sum = x1+x2+x3+x4
p(x1) = x1/sum
p(x4) = x4/sum
....
p(total) = p(x1) + p(x2) + p(x3) + p(x4) = 1
arynaq
  • 6,710
  • 9
  • 44
  • 74
  • your answer addresses part of my question as do the others, but I accept yours as it was the first. Off-course, all partial answers are owed my first incomplete question formulation. – leba-lev Jul 29 '13 at 17:01