-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65791a4
commit 60d5546
Showing
3 changed files
with
107 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
libact/query_strategies/multilabel/tests/test_multilabel_quire.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import unittest | ||
|
||
from numpy.testing import assert_array_equal | ||
import numpy as np | ||
|
||
from libact.base.dataset import Dataset | ||
from libact.query_strategies.multilabel import MultilabelQUIRE | ||
from libact.utils import run_qs | ||
|
||
|
||
class MultilabelQUIRETestCase(unittest.TestCase): | ||
"""Variance reduction test case using artifitial dataset""" | ||
def setUp(self): | ||
self.X = [[-2, -1], [1, 1], [-1, -2], [-1, -1], [1, 2], [2, 1]] | ||
self.y = [[0, 1], [1, 0], [0, 1], [1, 0], [1, 0], [1, 1]] | ||
self.quota = 4 | ||
|
||
def test_multilabel_quire(self): | ||
trn_ds = Dataset(self.X, (self.y[:2] + [None] * (len(self.y) - 2))) | ||
qs = MultilabelQUIRE(trn_ds) | ||
qseq = run_qs(trn_ds, qs, self.y, self.quota) | ||
assert_array_equal(qseq, np.array([2, 3, 4, 5])) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters