<p dir="auto">When using the DecisionTreeClassifier() sample_weight parameter, and weighting examples by class lable such as 2:1 for class A versus class B, the <strong>nvalues</strong> in the leaves of the tree produced by tree.export_graphviz() shows a duplicate count for the number of examples for the weighted class.</p>
<p dir="auto">This is misleading because the sum of each classes <strong>nvalues</strong> should equal the total number of examples in the parent node. It seems that there is a bug where the feature weighting factor is not removed when exporting the decision tree.</p>
<p dir="auto">Here is the classifier with weighting:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="clf = tree.DecisionTreeClassifier(
    criterion='gini', splitter='best', max_leaf_nodes=10,
    min_samples_split=10, min_samples_leaf=2, max_features=None,
    random_state=None).fit(X, y, sample_weight=df.LABEL.map({'A':2, 'B':1})) "><pre class="notranslate"><span class="pl-s1">clf</span> <span class="pl-c1">=</span> <span class="pl-s1">tree</span>.<span class="pl-v">DecisionTreeClassifier</span>(
    <span class="pl-s1">criterion</span><span class="pl-c1">=</span><span class="pl-s">'gini'</span>, <span class="pl-s1">splitter</span><span class="pl-c1">=</span><span class="pl-s">'best'</span>, <span class="pl-s1">max_leaf_nodes</span><span class="pl-c1">=</span><span class="pl-c1">10</span>,
    <span class="pl-s1">min_samples_split</span><span class="pl-c1">=</span><span class="pl-c1">10</span>, <span class="pl-s1">min_samples_leaf</span><span class="pl-c1">=</span><span class="pl-c1">2</span>, <span class="pl-s1">max_features</span><span class="pl-c1">=</span><span class="pl-c1">None</span>,
    <span class="pl-s1">random_state</span><span class="pl-c1">=</span><span class="pl-c1">None</span>).<span class="pl-en">fit</span>(<span class="pl-v">X</span>, <span class="pl-s1">y</span>, <span class="pl-s1">sample_weight</span><span class="pl-c1">=</span><span class="pl-s1">df</span>.<span class="pl-v">LABEL</span>.<span class="pl-en">map</span>({<span class="pl-s">'A'</span>:<span class="pl-c1">2</span>, <span class="pl-s">'B'</span>:<span class="pl-c1">1</span>})) </pre></div>
<p dir="auto">Here is the produced tree.dot file with the duplicate values shown in <strong>bold</strong>:</p>
<p dir="auto">digraph Tree {<br>
0 [label="X[106] &lt;= 0.0203\ngini = 0.0731494237327\nsamples = 119377", shape="box"] ;<br>
1 [label="X[34] &lt;= 1266.6650\ngini = 0.0661567536396\nsamples = 118307", shape="box"] ;<br>
0 -&gt; 1 ;<br>
3 [label="gini = 0.0578\nsamples = 111941\nvalue = [ <strong>210926</strong>.    6478.]", shape="box"] ;<br>
1 -&gt; 3 ;<br>
4 [label="gini = 0.2103\nsamples = 6366\nvalue = [ <strong>10016</strong>.   1358.]", shape="box"] ;<br>
1 -&gt; 4 ;<br>
2 [label="X[83] &lt;= 6728.4551\ngini = 0.386307949063\nsamples = 1070", shape="box"] ;<br>
0 -&gt; 2 ;<br>
5 [label="gini = 0.4994\nsamples = 364\nvalue = [ <strong>254</strong>.  237.]", shape="box"] ;<br>
2 -&gt; 5 ;<br>
6 [label="gini = 0.1669\nsamples = 706\nvalue = [  <strong>68</strong>.  672.]", shape="box"] ;<br>
2 -&gt; 6 ;<br>
}</p>
<p dir="auto">Here is what the tree looks like with duplicate leaf example counts for the weighted class:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/2701562/4742046/e052576a-5a1b-11e4-8855-f017ea75facc.png"><img src="https://cloud.githubusercontent.com/assets/2701562/4742046/e052576a-5a1b-11e4-8855-f017ea75facc.png" alt="img" style="max-width: 100%;"></a></p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jmetzen/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jmetzen">@jmetzen</a> thank you for contributing the new Gaussian Process module, it is really helpful! I wondered if it is possible to specify the input dimension(s) each kernel should be applied to? For example, if my input is 3-dimensional and I would like a kernel setup like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="kernel =   rational quadratic kernel on input dimension 2
         * RBF kernel on input dimension 3
         + periodic kernel on input dimensions 1 and 2"><pre class="notranslate"><code class="notranslate">kernel =   rational quadratic kernel on input dimension 2
         * RBF kernel on input dimension 3
         + periodic kernel on input dimensions 1 and 2
</code></pre></div>
<p dir="auto">Could this be achieved with the current state of the API?</p>