Exemplo n.º 1
0
def test_mean_squared_error(caplog):
    """Unit test of mean_squared_error_scorer."""
    caplog.set_level(logging.INFO)

    metric_dict = mean_squared_error_scorer(GOLDS, UNARY_PROBS, None)
    assert isequal(metric_dict, {"mean_squared_error": 0.1954166666666667})

    metric_dict = mean_squared_error_scorer(PROB_GOLDS, PROBS, None)
    assert isequal(metric_dict, {"mean_squared_error": 0.16708333333333336})
Exemplo n.º 2
0
def test_mean_squared_error(caplog):
    """Unit test of mean_squared_error_scorer"""

    caplog.set_level(logging.INFO)

    golds = np.array([3, -0.5, 2, 7])
    probs = np.array([2.5, 0.0, 2, 8])

    metric_dict = mean_squared_error_scorer(golds, probs, None)
    assert isequal(metric_dict, {"mean_squared_error": 0.375})

    golds = np.array([[0.5, 1], [-1, 1], [7, -6]])
    probs = np.array([[0, 2], [-1, 2], [8, -5]])

    metric_dict = mean_squared_error_scorer(golds, probs, None)
    assert isequal(metric_dict, {"mean_squared_error": 0.7083333333333334})