<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import sklearn.tree
import numpy as np

clf = sklearn.tree.DecisionTreeClassifier()
X = np.array([[1],[10]])
y = np.array([1000,2000])
clf = clf.fit(X,y)

X2 = np.array([[1]]) # right shape
clf.predict(X2)
clf.predict_proba(X2)

X3 = np.array([1]) # wrong shape
clf.predict(X3)
clf.predict_proba(X3)

X4 = np.array([[np.nan]]) # nan inputs
clf.predict(X4)
clf.predict_proba(X4)"><pre class="notranslate"><code class="notranslate">import sklearn.tree
import numpy as np

clf = sklearn.tree.DecisionTreeClassifier()
X = np.array([[1],[10]])
y = np.array([1000,2000])
clf = clf.fit(X,y)

X2 = np.array([[1]]) # right shape
clf.predict(X2)
clf.predict_proba(X2)

X3 = np.array([1]) # wrong shape
clf.predict(X3)
clf.predict_proba(X3)

X4 = np.array([[np.nan]]) # nan inputs
clf.predict(X4)
clf.predict_proba(X4)
</code></pre></div>
<p dir="auto">Probably should throw an exception if the shape is wrong or <code class="notranslate">np.nan</code> is in the input.</p>
<p dir="auto">And add a test in the common tests.</p>