示例#1
0
def test_fbeta_update2():
    x1 = Tensor(np.array([[0.2, 0.5, 0.7], [0.3, 0.1, 0.2], [0.9, 0.6, 0.5]]))
    y1 = Tensor(np.array([1, 0, 2]))
    x2 = Tensor(np.array([[0.2, 0.5], [0.3, 0.1], [0.9, 0.6]]))
    y2 = Tensor(np.array([1, 0, 2]))
    metric = Fbeta(2)
    metric.clear()
    metric.update(x1, y1)

    with pytest.raises(ValueError):
        metric.update(x2, y2)
示例#2
0
def test_fbeta_update1():
    x = Tensor(np.array([[0.2, 0.5, 0.7], [0.3, 0.1, 0.2], [0.9, 0.6, 0.5]]))
    y = Tensor(np.array([1, 0]))
    metric = Fbeta(2)
    metric.clear()

    with pytest.raises(ValueError):
        metric.update(x, y)
示例#3
0
def test_fbeta_runtime():
    metric = Fbeta(2)
    metric.clear()

    with pytest.raises(RuntimeError):
        metric.eval()
示例#4
0
def test_fbeta_init():
    with pytest.raises(ValueError):
        Fbeta(0)