提交 41b7a22b authored 作者: Bryn Keller's avatar Bryn Keller

Updated example to match example in sklearn.confusion_matrix

上级 eea40da7
...@@ -2439,12 +2439,12 @@ def confusion_matrix(actual, pred): ...@@ -2439,12 +2439,12 @@ def confusion_matrix(actual, pred):
>>> x = theano.tensor.vector() >>> x = theano.tensor.vector()
>>> y = theano.tensor.vector() >>> y = theano.tensor.vector()
>>> f = theano.function([x, y], confusion_matrix(x, y)) >>> f = theano.function([x, y], confusion_matrix(x, y))
>>> a = [0, 1, 2, 1, 0] >>> y_true = [2, 0, 2, 2, 0, 1]
>>> b = [0, 0, 2, 1, 2] >>> y_pred = [0, 0, 2, 2, 0, 2]
>>> print(f(a, b)) >>> print(f(y_true, y_pred))
[array([[0, 0, 1], [array([[2, 0, 0],
[2, 1, 0], [0, 0, 1],
[0, 0, 1]]), array([ 0., 1., 2.])] [1, 0, 2]]), array([ 0., 1., 2.])]
""" """
if actual.ndim != 1: if actual.ndim != 1:
raise ValueError('actual must be 1-d tensor variable') raise ValueError('actual must be 1-d tensor variable')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论