title: How to get pos/neg instance counts for all nodes of a scikit-learn decision tree?
body: <p>I've trained a sklearn decision tree.</p>
  
  <pre><code>from sklearn.tree import DecisionTreeClassifier
  c=DecisionTreeClassifier(class_weight="auto")
  c.fit([[0,0],
         [0,1],
         [1,1],
        ],[0,1,0])
  </code></pre>
  
  <p>Now I'd like to inspect how many positive/negative samples went to each node. Therefore a graph like</p>
  
  <pre><code>  counts: [2,1]            labels: (010)
                                   split by x0
      [1,1]       [1,0]         (01)        (0)
                             split by x1
   [1,0] [0,1]      0        (0)   (1)
     0     1
  </code></pre>
  
  <p>How can I get this (left counts) from a trained decision tree?</p>
  
  <p>I can see a <code>c.tree_</code> variable, but the content seems not to be very helpful. There are zeros, weights, ... and it's hard to guess how to get the counts back.</p>