How to convert an array of numbers into probability values?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I would like some help with respect to certain numerical computation. I have certain arrays which look like: Array 1: [0.81893085, 0.54768653, 0.14973508]
Array 2: [0.48078357, 0.92219683, 1.02359911]
Each of the three numbers in the array represents distance of a data point from the cluster centroid in k-means algorithm. I want to convert these numbers into probabilities. The element which has a high distance should be converted into a low probability. For example, [0.81893085, 0.54768653, 0.14973508] can be converted into a probability vector like [0.13, 0.22, 0.65]. As it can be seen, the elements which have a high value in the original array have low value in the probability array (and of course the values in the probability array sum to 1).
Is there any mathematical technique that will achieve this result?
What I have tried till now is, I took the inverse of each of the values in the original array:
1/[0.81893085, 0.54768653, 0.14973508] = [1.22110431, 1.82586195, 6.67846172]
And then I input the resulting array to softmax function (softmax function converts an array of numbers to probabilities) - https://en.wikipedia.org/wiki/Softmax_function
This gives a probability vector of [0.00421394, 0.00771491, 0.98807115]. Is this a good approach? Is there any other approach?
probability
add a comment |Â
up vote
0
down vote
favorite
I would like some help with respect to certain numerical computation. I have certain arrays which look like: Array 1: [0.81893085, 0.54768653, 0.14973508]
Array 2: [0.48078357, 0.92219683, 1.02359911]
Each of the three numbers in the array represents distance of a data point from the cluster centroid in k-means algorithm. I want to convert these numbers into probabilities. The element which has a high distance should be converted into a low probability. For example, [0.81893085, 0.54768653, 0.14973508] can be converted into a probability vector like [0.13, 0.22, 0.65]. As it can be seen, the elements which have a high value in the original array have low value in the probability array (and of course the values in the probability array sum to 1).
Is there any mathematical technique that will achieve this result?
What I have tried till now is, I took the inverse of each of the values in the original array:
1/[0.81893085, 0.54768653, 0.14973508] = [1.22110431, 1.82586195, 6.67846172]
And then I input the resulting array to softmax function (softmax function converts an array of numbers to probabilities) - https://en.wikipedia.org/wiki/Softmax_function
This gives a probability vector of [0.00421394, 0.00771491, 0.98807115]. Is this a good approach? Is there any other approach?
probability
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like some help with respect to certain numerical computation. I have certain arrays which look like: Array 1: [0.81893085, 0.54768653, 0.14973508]
Array 2: [0.48078357, 0.92219683, 1.02359911]
Each of the three numbers in the array represents distance of a data point from the cluster centroid in k-means algorithm. I want to convert these numbers into probabilities. The element which has a high distance should be converted into a low probability. For example, [0.81893085, 0.54768653, 0.14973508] can be converted into a probability vector like [0.13, 0.22, 0.65]. As it can be seen, the elements which have a high value in the original array have low value in the probability array (and of course the values in the probability array sum to 1).
Is there any mathematical technique that will achieve this result?
What I have tried till now is, I took the inverse of each of the values in the original array:
1/[0.81893085, 0.54768653, 0.14973508] = [1.22110431, 1.82586195, 6.67846172]
And then I input the resulting array to softmax function (softmax function converts an array of numbers to probabilities) - https://en.wikipedia.org/wiki/Softmax_function
This gives a probability vector of [0.00421394, 0.00771491, 0.98807115]. Is this a good approach? Is there any other approach?
probability
I would like some help with respect to certain numerical computation. I have certain arrays which look like: Array 1: [0.81893085, 0.54768653, 0.14973508]
Array 2: [0.48078357, 0.92219683, 1.02359911]
Each of the three numbers in the array represents distance of a data point from the cluster centroid in k-means algorithm. I want to convert these numbers into probabilities. The element which has a high distance should be converted into a low probability. For example, [0.81893085, 0.54768653, 0.14973508] can be converted into a probability vector like [0.13, 0.22, 0.65]. As it can be seen, the elements which have a high value in the original array have low value in the probability array (and of course the values in the probability array sum to 1).
Is there any mathematical technique that will achieve this result?
What I have tried till now is, I took the inverse of each of the values in the original array:
1/[0.81893085, 0.54768653, 0.14973508] = [1.22110431, 1.82586195, 6.67846172]
And then I input the resulting array to softmax function (softmax function converts an array of numbers to probabilities) - https://en.wikipedia.org/wiki/Softmax_function
This gives a probability vector of [0.00421394, 0.00771491, 0.98807115]. Is this a good approach? Is there any other approach?
probability
asked Aug 23 at 6:35
Sujeeth Kumaravel
1
1
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Inversing and softmaxing is one valid method of what you want to achieve: high distance means low probability. I guess what you want to consider is: how much.
For example, for Array 1, highest distance is only 5~6 times farther than smallest distance. But it resulted to 234 times of probability: 0.4% and 98.8%. Is this what you want?
I don't know there is a standard approach, but I suggest you just averaging out rather than softmaxing. This is possible because the values are all non-negative, since they're the inverse of distances. so that $[1.22110431, 1.82586195, 6.67846172]$ is divided by $9.72542798$, so you have $[0.12555789961, 0.18774103862, 0.68670106176]$. You decide the result: maybe you can add this result and your softmaxed result and divide by 2.(although that's never based on firm theory.) All of them are correct if you can get your desired result.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Inversing and softmaxing is one valid method of what you want to achieve: high distance means low probability. I guess what you want to consider is: how much.
For example, for Array 1, highest distance is only 5~6 times farther than smallest distance. But it resulted to 234 times of probability: 0.4% and 98.8%. Is this what you want?
I don't know there is a standard approach, but I suggest you just averaging out rather than softmaxing. This is possible because the values are all non-negative, since they're the inverse of distances. so that $[1.22110431, 1.82586195, 6.67846172]$ is divided by $9.72542798$, so you have $[0.12555789961, 0.18774103862, 0.68670106176]$. You decide the result: maybe you can add this result and your softmaxed result and divide by 2.(although that's never based on firm theory.) All of them are correct if you can get your desired result.
add a comment |Â
up vote
0
down vote
Inversing and softmaxing is one valid method of what you want to achieve: high distance means low probability. I guess what you want to consider is: how much.
For example, for Array 1, highest distance is only 5~6 times farther than smallest distance. But it resulted to 234 times of probability: 0.4% and 98.8%. Is this what you want?
I don't know there is a standard approach, but I suggest you just averaging out rather than softmaxing. This is possible because the values are all non-negative, since they're the inverse of distances. so that $[1.22110431, 1.82586195, 6.67846172]$ is divided by $9.72542798$, so you have $[0.12555789961, 0.18774103862, 0.68670106176]$. You decide the result: maybe you can add this result and your softmaxed result and divide by 2.(although that's never based on firm theory.) All of them are correct if you can get your desired result.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Inversing and softmaxing is one valid method of what you want to achieve: high distance means low probability. I guess what you want to consider is: how much.
For example, for Array 1, highest distance is only 5~6 times farther than smallest distance. But it resulted to 234 times of probability: 0.4% and 98.8%. Is this what you want?
I don't know there is a standard approach, but I suggest you just averaging out rather than softmaxing. This is possible because the values are all non-negative, since they're the inverse of distances. so that $[1.22110431, 1.82586195, 6.67846172]$ is divided by $9.72542798$, so you have $[0.12555789961, 0.18774103862, 0.68670106176]$. You decide the result: maybe you can add this result and your softmaxed result and divide by 2.(although that's never based on firm theory.) All of them are correct if you can get your desired result.
Inversing and softmaxing is one valid method of what you want to achieve: high distance means low probability. I guess what you want to consider is: how much.
For example, for Array 1, highest distance is only 5~6 times farther than smallest distance. But it resulted to 234 times of probability: 0.4% and 98.8%. Is this what you want?
I don't know there is a standard approach, but I suggest you just averaging out rather than softmaxing. This is possible because the values are all non-negative, since they're the inverse of distances. so that $[1.22110431, 1.82586195, 6.67846172]$ is divided by $9.72542798$, so you have $[0.12555789961, 0.18774103862, 0.68670106176]$. You decide the result: maybe you can add this result and your softmaxed result and divide by 2.(although that's never based on firm theory.) All of them are correct if you can get your desired result.
answered Aug 23 at 7:16
Jeong Jinmyeong
34617
34617
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2891778%2fhow-to-convert-an-array-of-numbers-into-probability-values%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password