How to compare paired count data?Can machine learning algorithms predict sports scores or plays?How to create Self learning data productPython: Handling imbalance Classes in python Machine LearningHow does one deploy a model, after building it in Python or Matlab?Predicting a Continuous output in a dataset with categoriesDifferent approaches of creating the test setPoor performance of SVM after training for rare eventsBest ML model for predicting yearly data with many blocks?Improving population weightingMulti-input Convolutional Neural Network for Images Classification

My bank got bought out, am I now going to have to start filing tax returns in a different state?

Is it acceptable to use working hours to read general interest books?

How can I practically buy stocks?

Why did C use the -> operator instead of reusing the . operator?

How bug prioritization works in agile projects vs non agile

Contradiction proof for inequality of P and NP?

Why do distances seem to matter in the Foundation world?

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

Injection into a proper class and choice without regularity

Can I criticise the more senior developers around me for not writing clean code?

Combinatorics problem, right solution?

Check if a string is entirely made of the same substring

Was Dennis Ritchie being too modest in this quote about C and Pascal?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

What does "function" actually mean in music?

Von Neumann Extractor - Which bit is retained?

What is the term for a person whose job is to place products on shelves in stores?

How do I check if a string is entirely made of the same substring?

Why is the underscore command _ useful?

Philosophical question on logistic regression: why isn't the optimal threshold value trained?

How long after the last departure shall the airport stay open for an emergency return?

How much of a wave function must reside inside event horizon for it to be consumed by the black hole?

SFDX - Create Objects with Custom Properties

Nails holding drywall



How to compare paired count data?


Can machine learning algorithms predict sports scores or plays?How to create Self learning data productPython: Handling imbalance Classes in python Machine LearningHow does one deploy a model, after building it in Python or Matlab?Predicting a Continuous output in a dataset with categoriesDifferent approaches of creating the test setPoor performance of SVM after training for rare eventsBest ML model for predicting yearly data with many blocks?Improving population weightingMulti-input Convolutional Neural Network for Images Classification













0












$begingroup$


I am working with a machine learning approach that counts cars in images. I have a predicted dataset, which is the predicted output from the machine learning approach and a paired "true" dataset, which is the result of a human going through each image and counting the number of cars.



The following is a sample of what the datasets look like (note that the actual dataset has 2500 paired samples):



import pandas as pd

d = 'true': [0,0,0,1,1,0,1,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
'predicted': [0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1]
df = pd.DataFrame(data=d)



 true predicted
0 0 0
1 0 0
2 0 0
3 1 0
4 1 0
5 0 0
6 1 1
7 0 0
8 0 0
9 0 0
10 0 0
11 0 0
12 0 0
13 0 0
14 4 2
15 2 2
16 0 0
17 0 0
18 0 0
19 0 0
20 0 0
21 0 0
22 0 0
23 0 0
24 0 1
25 0 0
26 0 0
27 0 0
28 0 0
29 0 0
30 0 0
31 0 0
32 1 1


I am looking for a way to present the predicted approach to an audience so that they see if the predictions are statistically the same as the true observations and visualize any trends in the data (e.g. the predicted approach has a tendency to over or under predict). If these were categorical data, I would use a confusion matrix, however, I am not sure how to deal with these paired, discrete datasets that are heavily weighted with 0's.



What approach can I take to statistically compare the predicted vs true datasets?










share|improve this question











$endgroup$





This question has an open bounty worth +50
reputation from Borealis ending ending at 2019-05-03 03:52:25Z">in 7 days.


The question is widely applicable to a large audience. A detailed canonical answer is required to address all the concerns.




















    0












    $begingroup$


    I am working with a machine learning approach that counts cars in images. I have a predicted dataset, which is the predicted output from the machine learning approach and a paired "true" dataset, which is the result of a human going through each image and counting the number of cars.



    The following is a sample of what the datasets look like (note that the actual dataset has 2500 paired samples):



    import pandas as pd

    d = 'true': [0,0,0,1,1,0,1,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    'predicted': [0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1]
    df = pd.DataFrame(data=d)



     true predicted
    0 0 0
    1 0 0
    2 0 0
    3 1 0
    4 1 0
    5 0 0
    6 1 1
    7 0 0
    8 0 0
    9 0 0
    10 0 0
    11 0 0
    12 0 0
    13 0 0
    14 4 2
    15 2 2
    16 0 0
    17 0 0
    18 0 0
    19 0 0
    20 0 0
    21 0 0
    22 0 0
    23 0 0
    24 0 1
    25 0 0
    26 0 0
    27 0 0
    28 0 0
    29 0 0
    30 0 0
    31 0 0
    32 1 1


    I am looking for a way to present the predicted approach to an audience so that they see if the predictions are statistically the same as the true observations and visualize any trends in the data (e.g. the predicted approach has a tendency to over or under predict). If these were categorical data, I would use a confusion matrix, however, I am not sure how to deal with these paired, discrete datasets that are heavily weighted with 0's.



    What approach can I take to statistically compare the predicted vs true datasets?










    share|improve this question











    $endgroup$





    This question has an open bounty worth +50
    reputation from Borealis ending ending at 2019-05-03 03:52:25Z">in 7 days.


    The question is widely applicable to a large audience. A detailed canonical answer is required to address all the concerns.


















      0












      0








      0





      $begingroup$


      I am working with a machine learning approach that counts cars in images. I have a predicted dataset, which is the predicted output from the machine learning approach and a paired "true" dataset, which is the result of a human going through each image and counting the number of cars.



      The following is a sample of what the datasets look like (note that the actual dataset has 2500 paired samples):



      import pandas as pd

      d = 'true': [0,0,0,1,1,0,1,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
      'predicted': [0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1]
      df = pd.DataFrame(data=d)



       true predicted
      0 0 0
      1 0 0
      2 0 0
      3 1 0
      4 1 0
      5 0 0
      6 1 1
      7 0 0
      8 0 0
      9 0 0
      10 0 0
      11 0 0
      12 0 0
      13 0 0
      14 4 2
      15 2 2
      16 0 0
      17 0 0
      18 0 0
      19 0 0
      20 0 0
      21 0 0
      22 0 0
      23 0 0
      24 0 1
      25 0 0
      26 0 0
      27 0 0
      28 0 0
      29 0 0
      30 0 0
      31 0 0
      32 1 1


      I am looking for a way to present the predicted approach to an audience so that they see if the predictions are statistically the same as the true observations and visualize any trends in the data (e.g. the predicted approach has a tendency to over or under predict). If these were categorical data, I would use a confusion matrix, however, I am not sure how to deal with these paired, discrete datasets that are heavily weighted with 0's.



      What approach can I take to statistically compare the predicted vs true datasets?










      share|improve this question











      $endgroup$




      I am working with a machine learning approach that counts cars in images. I have a predicted dataset, which is the predicted output from the machine learning approach and a paired "true" dataset, which is the result of a human going through each image and counting the number of cars.



      The following is a sample of what the datasets look like (note that the actual dataset has 2500 paired samples):



      import pandas as pd

      d = 'true': [0,0,0,1,1,0,1,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
      'predicted': [0,0,0,0,0,0,1,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1]
      df = pd.DataFrame(data=d)



       true predicted
      0 0 0
      1 0 0
      2 0 0
      3 1 0
      4 1 0
      5 0 0
      6 1 1
      7 0 0
      8 0 0
      9 0 0
      10 0 0
      11 0 0
      12 0 0
      13 0 0
      14 4 2
      15 2 2
      16 0 0
      17 0 0
      18 0 0
      19 0 0
      20 0 0
      21 0 0
      22 0 0
      23 0 0
      24 0 1
      25 0 0
      26 0 0
      27 0 0
      28 0 0
      29 0 0
      30 0 0
      31 0 0
      32 1 1


      I am looking for a way to present the predicted approach to an audience so that they see if the predictions are statistically the same as the true observations and visualize any trends in the data (e.g. the predicted approach has a tendency to over or under predict). If these were categorical data, I would use a confusion matrix, however, I am not sure how to deal with these paired, discrete datasets that are heavily weighted with 0's.



      What approach can I take to statistically compare the predicted vs true datasets?







      machine-learning python pandas accuracy






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 5 mins ago







      Borealis

















      asked Apr 16 at 2:47









      BorealisBorealis

      122213




      122213






      This question has an open bounty worth +50
      reputation from Borealis ending ending at 2019-05-03 03:52:25Z">in 7 days.


      The question is widely applicable to a large audience. A detailed canonical answer is required to address all the concerns.








      This question has an open bounty worth +50
      reputation from Borealis ending ending at 2019-05-03 03:52:25Z">in 7 days.


      The question is widely applicable to a large audience. A detailed canonical answer is required to address all the concerns.






















          1 Answer
          1






          active

          oldest

          votes


















          1












          $begingroup$

          You can use a simple error measure of $sum (real.people-predicted.people)^2+sum (real.cars-predicted.cars)^2$, the kind of problem you are dealing with has this objective function as the solved one.



          Actually, the algorithms implement this measure as their objective function.






          share|improve this answer











          $endgroup$












          • $begingroup$
            This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
            $endgroup$
            – Borealis
            Apr 16 at 4:31










          • $begingroup$
            You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
            $endgroup$
            – Juan Esteban de la Calle
            Apr 16 at 4:45











          • $begingroup$
            I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
            $endgroup$
            – Borealis
            52 secs ago












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "557"
          ;
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2fdatascience.stackexchange.com%2fquestions%2f49363%2fhow-to-compare-paired-count-data%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









          1












          $begingroup$

          You can use a simple error measure of $sum (real.people-predicted.people)^2+sum (real.cars-predicted.cars)^2$, the kind of problem you are dealing with has this objective function as the solved one.



          Actually, the algorithms implement this measure as their objective function.






          share|improve this answer











          $endgroup$












          • $begingroup$
            This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
            $endgroup$
            – Borealis
            Apr 16 at 4:31










          • $begingroup$
            You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
            $endgroup$
            – Juan Esteban de la Calle
            Apr 16 at 4:45











          • $begingroup$
            I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
            $endgroup$
            – Borealis
            52 secs ago
















          1












          $begingroup$

          You can use a simple error measure of $sum (real.people-predicted.people)^2+sum (real.cars-predicted.cars)^2$, the kind of problem you are dealing with has this objective function as the solved one.



          Actually, the algorithms implement this measure as their objective function.






          share|improve this answer











          $endgroup$












          • $begingroup$
            This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
            $endgroup$
            – Borealis
            Apr 16 at 4:31










          • $begingroup$
            You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
            $endgroup$
            – Juan Esteban de la Calle
            Apr 16 at 4:45











          • $begingroup$
            I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
            $endgroup$
            – Borealis
            52 secs ago














          1












          1








          1





          $begingroup$

          You can use a simple error measure of $sum (real.people-predicted.people)^2+sum (real.cars-predicted.cars)^2$, the kind of problem you are dealing with has this objective function as the solved one.



          Actually, the algorithms implement this measure as their objective function.






          share|improve this answer











          $endgroup$



          You can use a simple error measure of $sum (real.people-predicted.people)^2+sum (real.cars-predicted.cars)^2$, the kind of problem you are dealing with has this objective function as the solved one.



          Actually, the algorithms implement this measure as their objective function.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 16 at 4:46

























          answered Apr 16 at 3:23









          Juan Esteban de la CalleJuan Esteban de la Calle

          69122




          69122











          • $begingroup$
            This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
            $endgroup$
            – Borealis
            Apr 16 at 4:31










          • $begingroup$
            You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
            $endgroup$
            – Juan Esteban de la Calle
            Apr 16 at 4:45











          • $begingroup$
            I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
            $endgroup$
            – Borealis
            52 secs ago

















          • $begingroup$
            This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
            $endgroup$
            – Borealis
            Apr 16 at 4:31










          • $begingroup$
            You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
            $endgroup$
            – Juan Esteban de la Calle
            Apr 16 at 4:45











          • $begingroup$
            I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
            $endgroup$
            – Borealis
            52 secs ago
















          $begingroup$
          This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
          $endgroup$
          – Borealis
          Apr 16 at 4:31




          $begingroup$
          This approach would yield two numbers--one for each class. Would the results of your approach, for example, "person" -7 and "car" +4 be sufficient to describe the predicted accuracy?
          $endgroup$
          – Borealis
          Apr 16 at 4:31












          $begingroup$
          You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
          $endgroup$
          – Juan Esteban de la Calle
          Apr 16 at 4:45





          $begingroup$
          You are right, there is something to be corrected in the post. I edited it, I put the square in the difference, this way the errors will not substract.
          $endgroup$
          – Juan Esteban de la Calle
          Apr 16 at 4:45













          $begingroup$
          I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
          $endgroup$
          – Borealis
          52 secs ago





          $begingroup$
          I appreciate your help in this. I had to reword my question to clarify the problem I am trying to solve.
          $endgroup$
          – Borealis
          52 secs ago


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Data Science 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%2fdatascience.stackexchange.com%2fquestions%2f49363%2fhow-to-compare-paired-count-data%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

          ValueError: Error when checking input: expected conv2d_13_input to have shape (3, 150, 150) but got array with shape (150, 150, 3)2019 Community Moderator ElectionError when checking : expected dense_1_input to have shape (None, 5) but got array with shape (200, 1)Error 'Expected 2D array, got 1D array instead:'ValueError: Error when checking input: expected lstm_41_input to have 3 dimensions, but got array with shape (40000,100)ValueError: Error when checking target: expected dense_1 to have shape (7,) but got array with shape (1,)ValueError: Error when checking target: expected dense_2 to have shape (1,) but got array with shape (0,)Keras exception: ValueError: Error when checking input: expected conv2d_1_input to have shape (150, 150, 3) but got array with shape (256, 256, 3)Steps taking too long to completewhen checking input: expected dense_1_input to have shape (13328,) but got array with shape (317,)ValueError: Error when checking target: expected dense_3 to have shape (None, 1) but got array with shape (7715, 40000)Keras exception: Error when checking input: expected dense_input to have shape (2,) but got array with shape (1,)

          Ружовы пелікан Змест Знешні выгляд | Пашырэнне | Асаблівасці біялогіі | Літаратура | НавігацыяДагледжаная версіяправерана1 зменаДагледжаная версіяправерана1 змена/ 22697590 Сістэматыкана ВіківідахВыявына Вікісховішчы174693363011049382

          Illegal assignment from SObject to ContactFetching String, Id from Map - Illegal Assignment Id to Field / ObjectError: Compile Error: Illegal assignment from String to BooleanError: List has no rows for assignment to SObjectError on Test Class - System.QueryException: List has no rows for assignment to SObjectRemote action problemDML requires SObject or SObject list type error“Illegal assignment from List to List”Test Class Fail: Batch Class: System.QueryException: List has no rows for assignment to SObjectMapping to a user'List has no rows for assignment to SObject' Mystery