How to calculate the most likely output based in input values and their probabilities?












0














I have a set of values with their appropriate truthiness probabilities.
I need to find the most likely value based on all the available input values.
Note: Probabilities are subjective and can conflict - but they represent the truthiness of the final output.



E.g a data set like this.



data = [
{value: 1, probability: 1},
{value: 1, probability: 0.5}
];
// i would expect to output 1, because all input agree on the value and 1 is certain in its value.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 1}
];
// Id expect the value to be half way between 1 and 0.5. Both values are equally likely - so final output is in between the 2.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 0.1}
];
// Id expect the value to be almost 1 but not quite.
data = [
{value: 1, probability: 1},
{value: 1, probability: 0.1},
{value: 0.1, probability: 1},
{value: 0, probability: 0.5},
{value: 0, probability: 0.9},
... thousands of more values here ...
quickly gets complicated and cpu intensive
];









share|improve this question






















  • The most likely output in the third example is "1". The data does not say anything about other values, just 1 and 0.5. If you want to somehow interpolate between all the possible values and output that as a result, you need to reword the question.
    – kfx
    Nov 10 at 20:07












  • What is the actual question here?
    – charlietfl
    Nov 10 at 20:07










  • @kfx The most likely output is close to 1, but not 1 because there is a conflict between values. Each item in the array gives its "opinion" of what the value is. First entry says it is certainly 1. The other entry says it might be 0.5. So which is it ? Most likely 1, but not quite. In my real data set i have thousands of value/probability pairs.
    – Rainer Plumer
    Nov 10 at 20:15










  • Could you try being more precise in defining what the outcome should be? Do you have an interpolation formula in mind? As you say, So which is it ? Most likely 1 - so this is your answer unless you reword the question and make it more precise.
    – kfx
    Nov 10 at 20:17










  • @kfx The outcome should be a number(a value) that combines all the proposed values with their probabilities and returns a value that is the best at satisfying all the probability claims. I don't have any formulas/algorithms in mind(that's kind of what I'm looking for)
    – Rainer Plumer
    Nov 10 at 20:25
















0














I have a set of values with their appropriate truthiness probabilities.
I need to find the most likely value based on all the available input values.
Note: Probabilities are subjective and can conflict - but they represent the truthiness of the final output.



E.g a data set like this.



data = [
{value: 1, probability: 1},
{value: 1, probability: 0.5}
];
// i would expect to output 1, because all input agree on the value and 1 is certain in its value.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 1}
];
// Id expect the value to be half way between 1 and 0.5. Both values are equally likely - so final output is in between the 2.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 0.1}
];
// Id expect the value to be almost 1 but not quite.
data = [
{value: 1, probability: 1},
{value: 1, probability: 0.1},
{value: 0.1, probability: 1},
{value: 0, probability: 0.5},
{value: 0, probability: 0.9},
... thousands of more values here ...
quickly gets complicated and cpu intensive
];









share|improve this question






















  • The most likely output in the third example is "1". The data does not say anything about other values, just 1 and 0.5. If you want to somehow interpolate between all the possible values and output that as a result, you need to reword the question.
    – kfx
    Nov 10 at 20:07












  • What is the actual question here?
    – charlietfl
    Nov 10 at 20:07










  • @kfx The most likely output is close to 1, but not 1 because there is a conflict between values. Each item in the array gives its "opinion" of what the value is. First entry says it is certainly 1. The other entry says it might be 0.5. So which is it ? Most likely 1, but not quite. In my real data set i have thousands of value/probability pairs.
    – Rainer Plumer
    Nov 10 at 20:15










  • Could you try being more precise in defining what the outcome should be? Do you have an interpolation formula in mind? As you say, So which is it ? Most likely 1 - so this is your answer unless you reword the question and make it more precise.
    – kfx
    Nov 10 at 20:17










  • @kfx The outcome should be a number(a value) that combines all the proposed values with their probabilities and returns a value that is the best at satisfying all the probability claims. I don't have any formulas/algorithms in mind(that's kind of what I'm looking for)
    – Rainer Plumer
    Nov 10 at 20:25














0












0








0







I have a set of values with their appropriate truthiness probabilities.
I need to find the most likely value based on all the available input values.
Note: Probabilities are subjective and can conflict - but they represent the truthiness of the final output.



E.g a data set like this.



data = [
{value: 1, probability: 1},
{value: 1, probability: 0.5}
];
// i would expect to output 1, because all input agree on the value and 1 is certain in its value.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 1}
];
// Id expect the value to be half way between 1 and 0.5. Both values are equally likely - so final output is in between the 2.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 0.1}
];
// Id expect the value to be almost 1 but not quite.
data = [
{value: 1, probability: 1},
{value: 1, probability: 0.1},
{value: 0.1, probability: 1},
{value: 0, probability: 0.5},
{value: 0, probability: 0.9},
... thousands of more values here ...
quickly gets complicated and cpu intensive
];









share|improve this question













I have a set of values with their appropriate truthiness probabilities.
I need to find the most likely value based on all the available input values.
Note: Probabilities are subjective and can conflict - but they represent the truthiness of the final output.



E.g a data set like this.



data = [
{value: 1, probability: 1},
{value: 1, probability: 0.5}
];
// i would expect to output 1, because all input agree on the value and 1 is certain in its value.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 1}
];
// Id expect the value to be half way between 1 and 0.5. Both values are equally likely - so final output is in between the 2.
data = [
{value: 1, probability: 1},
{value: 0.5, probability: 0.1}
];
// Id expect the value to be almost 1 but not quite.
data = [
{value: 1, probability: 1},
{value: 1, probability: 0.1},
{value: 0.1, probability: 1},
{value: 0, probability: 0.5},
{value: 0, probability: 0.9},
... thousands of more values here ...
quickly gets complicated and cpu intensive
];






javascript algorithm math






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 20:04









Rainer Plumer

2,36311024




2,36311024












  • The most likely output in the third example is "1". The data does not say anything about other values, just 1 and 0.5. If you want to somehow interpolate between all the possible values and output that as a result, you need to reword the question.
    – kfx
    Nov 10 at 20:07












  • What is the actual question here?
    – charlietfl
    Nov 10 at 20:07










  • @kfx The most likely output is close to 1, but not 1 because there is a conflict between values. Each item in the array gives its "opinion" of what the value is. First entry says it is certainly 1. The other entry says it might be 0.5. So which is it ? Most likely 1, but not quite. In my real data set i have thousands of value/probability pairs.
    – Rainer Plumer
    Nov 10 at 20:15










  • Could you try being more precise in defining what the outcome should be? Do you have an interpolation formula in mind? As you say, So which is it ? Most likely 1 - so this is your answer unless you reword the question and make it more precise.
    – kfx
    Nov 10 at 20:17










  • @kfx The outcome should be a number(a value) that combines all the proposed values with their probabilities and returns a value that is the best at satisfying all the probability claims. I don't have any formulas/algorithms in mind(that's kind of what I'm looking for)
    – Rainer Plumer
    Nov 10 at 20:25


















  • The most likely output in the third example is "1". The data does not say anything about other values, just 1 and 0.5. If you want to somehow interpolate between all the possible values and output that as a result, you need to reword the question.
    – kfx
    Nov 10 at 20:07












  • What is the actual question here?
    – charlietfl
    Nov 10 at 20:07










  • @kfx The most likely output is close to 1, but not 1 because there is a conflict between values. Each item in the array gives its "opinion" of what the value is. First entry says it is certainly 1. The other entry says it might be 0.5. So which is it ? Most likely 1, but not quite. In my real data set i have thousands of value/probability pairs.
    – Rainer Plumer
    Nov 10 at 20:15










  • Could you try being more precise in defining what the outcome should be? Do you have an interpolation formula in mind? As you say, So which is it ? Most likely 1 - so this is your answer unless you reword the question and make it more precise.
    – kfx
    Nov 10 at 20:17










  • @kfx The outcome should be a number(a value) that combines all the proposed values with their probabilities and returns a value that is the best at satisfying all the probability claims. I don't have any formulas/algorithms in mind(that's kind of what I'm looking for)
    – Rainer Plumer
    Nov 10 at 20:25
















The most likely output in the third example is "1". The data does not say anything about other values, just 1 and 0.5. If you want to somehow interpolate between all the possible values and output that as a result, you need to reword the question.
– kfx
Nov 10 at 20:07






The most likely output in the third example is "1". The data does not say anything about other values, just 1 and 0.5. If you want to somehow interpolate between all the possible values and output that as a result, you need to reword the question.
– kfx
Nov 10 at 20:07














What is the actual question here?
– charlietfl
Nov 10 at 20:07




What is the actual question here?
– charlietfl
Nov 10 at 20:07












@kfx The most likely output is close to 1, but not 1 because there is a conflict between values. Each item in the array gives its "opinion" of what the value is. First entry says it is certainly 1. The other entry says it might be 0.5. So which is it ? Most likely 1, but not quite. In my real data set i have thousands of value/probability pairs.
– Rainer Plumer
Nov 10 at 20:15




@kfx The most likely output is close to 1, but not 1 because there is a conflict between values. Each item in the array gives its "opinion" of what the value is. First entry says it is certainly 1. The other entry says it might be 0.5. So which is it ? Most likely 1, but not quite. In my real data set i have thousands of value/probability pairs.
– Rainer Plumer
Nov 10 at 20:15












Could you try being more precise in defining what the outcome should be? Do you have an interpolation formula in mind? As you say, So which is it ? Most likely 1 - so this is your answer unless you reword the question and make it more precise.
– kfx
Nov 10 at 20:17




Could you try being more precise in defining what the outcome should be? Do you have an interpolation formula in mind? As you say, So which is it ? Most likely 1 - so this is your answer unless you reword the question and make it more precise.
– kfx
Nov 10 at 20:17












@kfx The outcome should be a number(a value) that combines all the proposed values with their probabilities and returns a value that is the best at satisfying all the probability claims. I don't have any formulas/algorithms in mind(that's kind of what I'm looking for)
– Rainer Plumer
Nov 10 at 20:25




@kfx The outcome should be a number(a value) that combines all the proposed values with their probabilities and returns a value that is the best at satisfying all the probability claims. I don't have any formulas/algorithms in mind(that's kind of what I'm looking for)
– Rainer Plumer
Nov 10 at 20:25












1 Answer
1






active

oldest

votes


















0














Seems like you're looking for a weighted average. Multiply each value by its probability, compute the sum of the products, and divide by the sum of the probabilities.



First example:  (1.0*1.0 + 1.0*0.5) / (1.0+0.5) = 1.5/1.5  = 1.00 
Second example: (1.0*1.0 + 0.5*1.0) / (1.0+1.0) = 1.5/2.0 = 0.75
Third example: (1.0*1.0 + 0.5*0.1) / (1.0+0.1) = 1.05/1.1 = 0.95





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242942%2fhow-to-calculate-the-most-likely-output-based-in-input-values-and-their-probabil%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Seems like you're looking for a weighted average. Multiply each value by its probability, compute the sum of the products, and divide by the sum of the probabilities.



    First example:  (1.0*1.0 + 1.0*0.5) / (1.0+0.5) = 1.5/1.5  = 1.00 
    Second example: (1.0*1.0 + 0.5*1.0) / (1.0+1.0) = 1.5/2.0 = 0.75
    Third example: (1.0*1.0 + 0.5*0.1) / (1.0+0.1) = 1.05/1.1 = 0.95





    share|improve this answer


























      0














      Seems like you're looking for a weighted average. Multiply each value by its probability, compute the sum of the products, and divide by the sum of the probabilities.



      First example:  (1.0*1.0 + 1.0*0.5) / (1.0+0.5) = 1.5/1.5  = 1.00 
      Second example: (1.0*1.0 + 0.5*1.0) / (1.0+1.0) = 1.5/2.0 = 0.75
      Third example: (1.0*1.0 + 0.5*0.1) / (1.0+0.1) = 1.05/1.1 = 0.95





      share|improve this answer
























        0












        0








        0






        Seems like you're looking for a weighted average. Multiply each value by its probability, compute the sum of the products, and divide by the sum of the probabilities.



        First example:  (1.0*1.0 + 1.0*0.5) / (1.0+0.5) = 1.5/1.5  = 1.00 
        Second example: (1.0*1.0 + 0.5*1.0) / (1.0+1.0) = 1.5/2.0 = 0.75
        Third example: (1.0*1.0 + 0.5*0.1) / (1.0+0.1) = 1.05/1.1 = 0.95





        share|improve this answer












        Seems like you're looking for a weighted average. Multiply each value by its probability, compute the sum of the products, and divide by the sum of the probabilities.



        First example:  (1.0*1.0 + 1.0*0.5) / (1.0+0.5) = 1.5/1.5  = 1.00 
        Second example: (1.0*1.0 + 0.5*1.0) / (1.0+1.0) = 1.5/2.0 = 0.75
        Third example: (1.0*1.0 + 0.5*0.1) / (1.0+0.1) = 1.05/1.1 = 0.95






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 at 22:15









        user3386109

        27.9k53247




        27.9k53247






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242942%2fhow-to-calculate-the-most-likely-output-based-in-input-values-and-their-probabil%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Academy of Television Arts & Sciences

            L'Équipe

            1995 France bombings