two-different-sections question about python code












-2















i'm new to python so this is a two-different-sections question... first I don't understand what this code means and whats for the DESCR this supposed to be for description isn't ? and for the split part with values? i don't understand the values



datasets = [ds.DESCR.split()[0] for ds in datasets]
clf_name = [str(clf).split('(')[0][:12] for clf in clfs]


second when do i use np.ones or np.zeros i know to generate an array of ones or zeros but what i mean is is when specificly in data science does it require me to initialize an array with ones or zeros?










share|improve this question























  • Please re-edit your question because it's hard to understand what is the problem here, also it's hard to understand what some piece of code does when you get only two lines to analyze.

    – Picard
    Nov 15 '18 at 22:18











  • I'm supposed to do a comparison between two algorithms on two datasets to see which one has the best performance on which dataset but the problem is that i don't understand how to split the values ? any ideas

    – Joseph_
    Nov 15 '18 at 22:24
















-2















i'm new to python so this is a two-different-sections question... first I don't understand what this code means and whats for the DESCR this supposed to be for description isn't ? and for the split part with values? i don't understand the values



datasets = [ds.DESCR.split()[0] for ds in datasets]
clf_name = [str(clf).split('(')[0][:12] for clf in clfs]


second when do i use np.ones or np.zeros i know to generate an array of ones or zeros but what i mean is is when specificly in data science does it require me to initialize an array with ones or zeros?










share|improve this question























  • Please re-edit your question because it's hard to understand what is the problem here, also it's hard to understand what some piece of code does when you get only two lines to analyze.

    – Picard
    Nov 15 '18 at 22:18











  • I'm supposed to do a comparison between two algorithms on two datasets to see which one has the best performance on which dataset but the problem is that i don't understand how to split the values ? any ideas

    – Joseph_
    Nov 15 '18 at 22:24














-2












-2








-2








i'm new to python so this is a two-different-sections question... first I don't understand what this code means and whats for the DESCR this supposed to be for description isn't ? and for the split part with values? i don't understand the values



datasets = [ds.DESCR.split()[0] for ds in datasets]
clf_name = [str(clf).split('(')[0][:12] for clf in clfs]


second when do i use np.ones or np.zeros i know to generate an array of ones or zeros but what i mean is is when specificly in data science does it require me to initialize an array with ones or zeros?










share|improve this question














i'm new to python so this is a two-different-sections question... first I don't understand what this code means and whats for the DESCR this supposed to be for description isn't ? and for the split part with values? i don't understand the values



datasets = [ds.DESCR.split()[0] for ds in datasets]
clf_name = [str(clf).split('(')[0][:12] for clf in clfs]


second when do i use np.ones or np.zeros i know to generate an array of ones or zeros but what i mean is is when specificly in data science does it require me to initialize an array with ones or zeros?







python machine-learning






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 21:58









Joseph_Joseph_

4




4













  • Please re-edit your question because it's hard to understand what is the problem here, also it's hard to understand what some piece of code does when you get only two lines to analyze.

    – Picard
    Nov 15 '18 at 22:18











  • I'm supposed to do a comparison between two algorithms on two datasets to see which one has the best performance on which dataset but the problem is that i don't understand how to split the values ? any ideas

    – Joseph_
    Nov 15 '18 at 22:24



















  • Please re-edit your question because it's hard to understand what is the problem here, also it's hard to understand what some piece of code does when you get only two lines to analyze.

    – Picard
    Nov 15 '18 at 22:18











  • I'm supposed to do a comparison between two algorithms on two datasets to see which one has the best performance on which dataset but the problem is that i don't understand how to split the values ? any ideas

    – Joseph_
    Nov 15 '18 at 22:24

















Please re-edit your question because it's hard to understand what is the problem here, also it's hard to understand what some piece of code does when you get only two lines to analyze.

– Picard
Nov 15 '18 at 22:18





Please re-edit your question because it's hard to understand what is the problem here, also it's hard to understand what some piece of code does when you get only two lines to analyze.

– Picard
Nov 15 '18 at 22:18













I'm supposed to do a comparison between two algorithms on two datasets to see which one has the best performance on which dataset but the problem is that i don't understand how to split the values ? any ideas

– Joseph_
Nov 15 '18 at 22:24





I'm supposed to do a comparison between two algorithms on two datasets to see which one has the best performance on which dataset but the problem is that i don't understand how to split the values ? any ideas

– Joseph_
Nov 15 '18 at 22:24












2 Answers
2






active

oldest

votes


















0














This code is creating two lists using list comprehension.

The ds.DESCR and other expressions here can mean anything, depending on the context.



As for your second sub-question, I'd advise to as something more specific.
If you need ones, you use np.ones, if you need zeros, you use np.zeros. That's it.






share|improve this answer































    0














    Np.zeros is great if you for example gradually update your matrix with values. Every entry that is not updated by your algorithm stays zero.



    In application this could be a matrix that shows you edges in a picture. You create a matrix of the size of the picture filled with zeros and then go over the picture with an kernel that detects edges. For every edge you detect you increase the value in the matrix at the position of the detected edge.



    A matrix or a vector of ones is great to do some matrix multiplications. Assume some vector of shape (n,1) x (1,n) of a Vector filled with ones will expand the vector to a matrix of shape (n,n). This is and similar cases can make a vector/matrix of ones necessary.






    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%2f53328481%2ftwo-different-sections-question-about-python-code%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      This code is creating two lists using list comprehension.

      The ds.DESCR and other expressions here can mean anything, depending on the context.



      As for your second sub-question, I'd advise to as something more specific.
      If you need ones, you use np.ones, if you need zeros, you use np.zeros. That's it.






      share|improve this answer




























        0














        This code is creating two lists using list comprehension.

        The ds.DESCR and other expressions here can mean anything, depending on the context.



        As for your second sub-question, I'd advise to as something more specific.
        If you need ones, you use np.ones, if you need zeros, you use np.zeros. That's it.






        share|improve this answer


























          0












          0








          0







          This code is creating two lists using list comprehension.

          The ds.DESCR and other expressions here can mean anything, depending on the context.



          As for your second sub-question, I'd advise to as something more specific.
          If you need ones, you use np.ones, if you need zeros, you use np.zeros. That's it.






          share|improve this answer













          This code is creating two lists using list comprehension.

          The ds.DESCR and other expressions here can mean anything, depending on the context.



          As for your second sub-question, I'd advise to as something more specific.
          If you need ones, you use np.ones, if you need zeros, you use np.zeros. That's it.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 22:08









          Viacheslav ShalamovViacheslav Shalamov

          1,32521532




          1,32521532

























              0














              Np.zeros is great if you for example gradually update your matrix with values. Every entry that is not updated by your algorithm stays zero.



              In application this could be a matrix that shows you edges in a picture. You create a matrix of the size of the picture filled with zeros and then go over the picture with an kernel that detects edges. For every edge you detect you increase the value in the matrix at the position of the detected edge.



              A matrix or a vector of ones is great to do some matrix multiplications. Assume some vector of shape (n,1) x (1,n) of a Vector filled with ones will expand the vector to a matrix of shape (n,n). This is and similar cases can make a vector/matrix of ones necessary.






              share|improve this answer




























                0














                Np.zeros is great if you for example gradually update your matrix with values. Every entry that is not updated by your algorithm stays zero.



                In application this could be a matrix that shows you edges in a picture. You create a matrix of the size of the picture filled with zeros and then go over the picture with an kernel that detects edges. For every edge you detect you increase the value in the matrix at the position of the detected edge.



                A matrix or a vector of ones is great to do some matrix multiplications. Assume some vector of shape (n,1) x (1,n) of a Vector filled with ones will expand the vector to a matrix of shape (n,n). This is and similar cases can make a vector/matrix of ones necessary.






                share|improve this answer


























                  0












                  0








                  0







                  Np.zeros is great if you for example gradually update your matrix with values. Every entry that is not updated by your algorithm stays zero.



                  In application this could be a matrix that shows you edges in a picture. You create a matrix of the size of the picture filled with zeros and then go over the picture with an kernel that detects edges. For every edge you detect you increase the value in the matrix at the position of the detected edge.



                  A matrix or a vector of ones is great to do some matrix multiplications. Assume some vector of shape (n,1) x (1,n) of a Vector filled with ones will expand the vector to a matrix of shape (n,n). This is and similar cases can make a vector/matrix of ones necessary.






                  share|improve this answer













                  Np.zeros is great if you for example gradually update your matrix with values. Every entry that is not updated by your algorithm stays zero.



                  In application this could be a matrix that shows you edges in a picture. You create a matrix of the size of the picture filled with zeros and then go over the picture with an kernel that detects edges. For every edge you detect you increase the value in the matrix at the position of the detected edge.



                  A matrix or a vector of ones is great to do some matrix multiplications. Assume some vector of shape (n,1) x (1,n) of a Vector filled with ones will expand the vector to a matrix of shape (n,n). This is and similar cases can make a vector/matrix of ones necessary.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 '18 at 22:09









                  AussAuss

                  585




                  585






























                      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.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53328481%2ftwo-different-sections-question-about-python-code%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

                      Bressuire

                      Vorschmack

                      Quarantine