bd53f54fb666459dc54af4de52032a65fca551be,sklearn/tests/test_multiclass.py,,test_ovr_always_present,#,190

Before Change


    y[:, 2] = 1

    ovr = OneVsRestClassifier(LogisticRegression())
    assert_warns(UserWarning, ovr.fit, X, y)
    y_pred = ovr.predict(X)
    assert_array_equal(np.array(y_pred), np.array(y))
    y_pred = ovr.decision_function(X)
    assert np.unique(y_pred[:, -2:]) == 1

After Change


    y[:, 2] = 1

    ovr = OneVsRestClassifier(LogisticRegression())
    msg = r"Label .+ is present in all training examples"
    with pytest.warns(UserWarning, match=msg):
        ovr.fit(X, y)
    y_pred = ovr.predict(X)
    assert_array_equal(np.array(y_pred), np.array(y))
    y_pred = ovr.decision_function(X)
    assert np.unique(y_pred[:, -2:]) == 1
    y_pred = ovr.predict_proba(X)
    assert_array_equal(y_pred[:, -1], np.ones(X.shape[0]))

    // y has a constantly absent label
    y = np.zeros((10, 2))
    y[5:, 0] = 1  // variable label
    ovr = OneVsRestClassifier(LogisticRegression())

    msg = r"Label not 1 is present in all training examples"
    with pytest.warns(UserWarning, match=msg):
        ovr.fit(X, y)
    y_pred = ovr.predict_proba(X)
    assert_array_equal(y_pred[:, -1], np.zeros(X.shape[0]))

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: scikit-learn/scikit-learn
Commit Name: bd53f54fb666459dc54af4de52032a65fca551be
Time: 2021-03-03
Author: alihanz@gmail.com
File Name: sklearn/tests/test_multiclass.py
Class Name:
Method Name: test_ovr_always_present


Project Name: scikit-learn/scikit-learn
Commit Name: 3e45aeef901871b84ce59709e62f3d2245463cd8
Time: 2021-03-20
Author: 56136443+LSturtew@users.noreply.github.com
File Name: sklearn/preprocessing/tests/test_function_transformer.py
Class Name:
Method Name: test_check_inverse


Project Name: scikit-learn/scikit-learn
Commit Name: bd53f54fb666459dc54af4de52032a65fca551be
Time: 2021-03-03
Author: alihanz@gmail.com
File Name: sklearn/tests/test_multiclass.py
Class Name:
Method Name: test_ovr_always_present


Project Name: scikit-learn/scikit-learn
Commit Name: 70af34c4afd34dbb604ef888846b2d62e93cf225
Time: 2021-02-25
Author: 32871888+anashas@users.noreply.github.com
File Name: sklearn/semi_supervised/tests/test_label_propagation.py
Class Name:
Method Name: test_convergence_warning