How to find the split in the given set of numbers.












1












$begingroup$


Beforehand I would like to express apologies if this sort of question is not suited here, but I desperately need it answered.



I have a set of numbers:




[2, 5, 6, 2, 2, 81, 72, 77]




From the above set, we can say that certain numbers above can be "grouped" together. Such that:




[2, 5, 6, 2, 2]




and




[81, 72, 77]




My question is how do I obtain the above two groupings? Is there an algorithm or formulae to achieve this?










share|cite|improve this question











$endgroup$












  • $begingroup$
    Do you know in advance how many groups you will have? If so, you can use some of the standard clustering algorithms like $k$-means clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:37










  • $begingroup$
    The term you should look up is "cluster analysis". In general it's a hard problem to specify, and it's often hard to solve once it's been well-specified.
    $endgroup$
    – Patrick Stevens
    Jan 15 at 14:37










  • $begingroup$
    Suppose there can be any number of samples in the set. But ultimately what I want is to split the set in such a way that the numbers all lie closest to a certain "mean".
    $endgroup$
    – randem_gen_guy
    Jan 15 at 14:43










  • $begingroup$
    @randem_gen_guy: What I'm asking is not how many numbers would be in the set to begin with, nor how many numbers will wind up in each group after you've grouped them. What I'm asking is do you know in advance how many groups you want to group your numbers into? In your example, two groups totally makes sense. Do you know beforehand how many groups you will need?
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:45






  • 1




    $begingroup$
    Check out en.wikipedia.org/wiki/K-means_clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:47
















1












$begingroup$


Beforehand I would like to express apologies if this sort of question is not suited here, but I desperately need it answered.



I have a set of numbers:




[2, 5, 6, 2, 2, 81, 72, 77]




From the above set, we can say that certain numbers above can be "grouped" together. Such that:




[2, 5, 6, 2, 2]




and




[81, 72, 77]




My question is how do I obtain the above two groupings? Is there an algorithm or formulae to achieve this?










share|cite|improve this question











$endgroup$












  • $begingroup$
    Do you know in advance how many groups you will have? If so, you can use some of the standard clustering algorithms like $k$-means clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:37










  • $begingroup$
    The term you should look up is "cluster analysis". In general it's a hard problem to specify, and it's often hard to solve once it's been well-specified.
    $endgroup$
    – Patrick Stevens
    Jan 15 at 14:37










  • $begingroup$
    Suppose there can be any number of samples in the set. But ultimately what I want is to split the set in such a way that the numbers all lie closest to a certain "mean".
    $endgroup$
    – randem_gen_guy
    Jan 15 at 14:43










  • $begingroup$
    @randem_gen_guy: What I'm asking is not how many numbers would be in the set to begin with, nor how many numbers will wind up in each group after you've grouped them. What I'm asking is do you know in advance how many groups you want to group your numbers into? In your example, two groups totally makes sense. Do you know beforehand how many groups you will need?
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:45






  • 1




    $begingroup$
    Check out en.wikipedia.org/wiki/K-means_clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:47














1












1








1





$begingroup$


Beforehand I would like to express apologies if this sort of question is not suited here, but I desperately need it answered.



I have a set of numbers:




[2, 5, 6, 2, 2, 81, 72, 77]




From the above set, we can say that certain numbers above can be "grouped" together. Such that:




[2, 5, 6, 2, 2]




and




[81, 72, 77]




My question is how do I obtain the above two groupings? Is there an algorithm or formulae to achieve this?










share|cite|improve this question











$endgroup$




Beforehand I would like to express apologies if this sort of question is not suited here, but I desperately need it answered.



I have a set of numbers:




[2, 5, 6, 2, 2, 81, 72, 77]




From the above set, we can say that certain numbers above can be "grouped" together. Such that:




[2, 5, 6, 2, 2]




and




[81, 72, 77]




My question is how do I obtain the above two groupings? Is there an algorithm or formulae to achieve this?







real-numbers sorting






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 15 at 14:36









Andrés E. Caicedo

65.5k8158249




65.5k8158249










asked Jan 15 at 14:31









randem_gen_guyrandem_gen_guy

61




61












  • $begingroup$
    Do you know in advance how many groups you will have? If so, you can use some of the standard clustering algorithms like $k$-means clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:37










  • $begingroup$
    The term you should look up is "cluster analysis". In general it's a hard problem to specify, and it's often hard to solve once it's been well-specified.
    $endgroup$
    – Patrick Stevens
    Jan 15 at 14:37










  • $begingroup$
    Suppose there can be any number of samples in the set. But ultimately what I want is to split the set in such a way that the numbers all lie closest to a certain "mean".
    $endgroup$
    – randem_gen_guy
    Jan 15 at 14:43










  • $begingroup$
    @randem_gen_guy: What I'm asking is not how many numbers would be in the set to begin with, nor how many numbers will wind up in each group after you've grouped them. What I'm asking is do you know in advance how many groups you want to group your numbers into? In your example, two groups totally makes sense. Do you know beforehand how many groups you will need?
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:45






  • 1




    $begingroup$
    Check out en.wikipedia.org/wiki/K-means_clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:47


















  • $begingroup$
    Do you know in advance how many groups you will have? If so, you can use some of the standard clustering algorithms like $k$-means clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:37










  • $begingroup$
    The term you should look up is "cluster analysis". In general it's a hard problem to specify, and it's often hard to solve once it's been well-specified.
    $endgroup$
    – Patrick Stevens
    Jan 15 at 14:37










  • $begingroup$
    Suppose there can be any number of samples in the set. But ultimately what I want is to split the set in such a way that the numbers all lie closest to a certain "mean".
    $endgroup$
    – randem_gen_guy
    Jan 15 at 14:43










  • $begingroup$
    @randem_gen_guy: What I'm asking is not how many numbers would be in the set to begin with, nor how many numbers will wind up in each group after you've grouped them. What I'm asking is do you know in advance how many groups you want to group your numbers into? In your example, two groups totally makes sense. Do you know beforehand how many groups you will need?
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:45






  • 1




    $begingroup$
    Check out en.wikipedia.org/wiki/K-means_clustering.
    $endgroup$
    – Adrian Keister
    Jan 15 at 14:47
















$begingroup$
Do you know in advance how many groups you will have? If so, you can use some of the standard clustering algorithms like $k$-means clustering.
$endgroup$
– Adrian Keister
Jan 15 at 14:37




$begingroup$
Do you know in advance how many groups you will have? If so, you can use some of the standard clustering algorithms like $k$-means clustering.
$endgroup$
– Adrian Keister
Jan 15 at 14:37












$begingroup$
The term you should look up is "cluster analysis". In general it's a hard problem to specify, and it's often hard to solve once it's been well-specified.
$endgroup$
– Patrick Stevens
Jan 15 at 14:37




$begingroup$
The term you should look up is "cluster analysis". In general it's a hard problem to specify, and it's often hard to solve once it's been well-specified.
$endgroup$
– Patrick Stevens
Jan 15 at 14:37












$begingroup$
Suppose there can be any number of samples in the set. But ultimately what I want is to split the set in such a way that the numbers all lie closest to a certain "mean".
$endgroup$
– randem_gen_guy
Jan 15 at 14:43




$begingroup$
Suppose there can be any number of samples in the set. But ultimately what I want is to split the set in such a way that the numbers all lie closest to a certain "mean".
$endgroup$
– randem_gen_guy
Jan 15 at 14:43












$begingroup$
@randem_gen_guy: What I'm asking is not how many numbers would be in the set to begin with, nor how many numbers will wind up in each group after you've grouped them. What I'm asking is do you know in advance how many groups you want to group your numbers into? In your example, two groups totally makes sense. Do you know beforehand how many groups you will need?
$endgroup$
– Adrian Keister
Jan 15 at 14:45




$begingroup$
@randem_gen_guy: What I'm asking is not how many numbers would be in the set to begin with, nor how many numbers will wind up in each group after you've grouped them. What I'm asking is do you know in advance how many groups you want to group your numbers into? In your example, two groups totally makes sense. Do you know beforehand how many groups you will need?
$endgroup$
– Adrian Keister
Jan 15 at 14:45




1




1




$begingroup$
Check out en.wikipedia.org/wiki/K-means_clustering.
$endgroup$
– Adrian Keister
Jan 15 at 14:47




$begingroup$
Check out en.wikipedia.org/wiki/K-means_clustering.
$endgroup$
– Adrian Keister
Jan 15 at 14:47










1 Answer
1






active

oldest

votes


















0












$begingroup$

Figured it out. As mentioned in the comments below my question, many people were recommending the K-Means algorithm. It worked perfectly!






share|cite|improve this answer









$endgroup$













    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',
    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
    },
    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%2f3074499%2fhow-to-find-the-split-in-the-given-set-of-numbers%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












    $begingroup$

    Figured it out. As mentioned in the comments below my question, many people were recommending the K-Means algorithm. It worked perfectly!






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      Figured it out. As mentioned in the comments below my question, many people were recommending the K-Means algorithm. It worked perfectly!






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        Figured it out. As mentioned in the comments below my question, many people were recommending the K-Means algorithm. It worked perfectly!






        share|cite|improve this answer









        $endgroup$



        Figured it out. As mentioned in the comments below my question, many people were recommending the K-Means algorithm. It worked perfectly!







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Jan 15 at 23:23









        randem_gen_guyrandem_gen_guy

        61




        61






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • 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.


            Use MathJax to format equations. MathJax reference.


            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%2fmath.stackexchange.com%2fquestions%2f3074499%2fhow-to-find-the-split-in-the-given-set-of-numbers%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







            Popular posts from this blog

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]