Skip to content

SCML iris test refactor [Minor] #332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Oct 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/metric_learn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,17 @@ def test_singular_returns_pseudo_inverse(self):
class TestSCML(object):
@pytest.mark.parametrize('basis', ('lda', 'triplet_diffs'))
def test_iris(self, basis):
"""
SCML applied to Iris dataset should give better results when
computing class separation.
"""
X, y = load_iris(return_X_y=True)
before = class_separation(X, y)
scml = SCML_Supervised(basis=basis, n_basis=85, k_genuine=7, k_impostor=5,
random_state=42)
scml.fit(X, y)
csep = class_separation(scml.transform(X), y)
assert csep < 0.24
after = class_separation(scml.transform(X), y)
assert before > after + 0.03 # It's better by a margin of 0.03

def test_big_n_features(self):
X, y = make_classification(n_samples=100, n_classes=3, n_features=60,
Expand Down