How to convert an array of numbers into probability values?

The name of the pictureThe name of the pictureThe name of the pictureClash 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?







share|cite|improve this question
























    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?







    share|cite|improve this question






















      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?







      share|cite|improve this question












      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?









      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Aug 23 at 6:35









      Sujeeth Kumaravel

      1




      1




















          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.






          share|cite|improve this answer




















            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%2f2891778%2fhow-to-convert-an-array-of-numbers-into-probability-values%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
            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.






            share|cite|improve this answer
























              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.






              share|cite|improve this answer






















                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.






                share|cite|improve this answer












                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.







                share|cite|improve this answer












                share|cite|improve this answer



                share|cite|improve this answer










                answered Aug 23 at 7:16









                Jeong Jinmyeong

                34617




                34617



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    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













































































                    這個網誌中的熱門文章

                    How to combine Bézier curves to a surface?

                    Mutual Information Always Non-negative

                    Why am i infinitely getting the same tweet with the Twitter Search API?