-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_environment.py
49 lines (39 loc) · 1.32 KB
/
test_environment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""
File:
test_environment.py
Authors:
- Abir Riahi
- Nicolas Raymond
- Simon Giard-Leroux
Description:
Test environment to test the active learning loop.
"""
import sys
from src.data.constants import *
from src.models.constants import *
from src.models.ActiveLearning import ActiveLearner
REQUIRED_PYTHON = "python3"
def main():
system_major = sys.version_info.major
if REQUIRED_PYTHON == "python":
required_major = 2
elif REQUIRED_PYTHON == "python3":
required_major = 3
else:
raise ValueError("Unrecognized python interpreter: {}".format(
REQUIRED_PYTHON))
if system_major != required_major:
raise TypeError(
"This project requires Python {}. Found: Python {}".format(
required_major, sys.version))
else:
print(">>> Development environment passes all tests!")
if __name__ == '__main__':
# Development tests
main()
# Active learning test
active_learner = ActiveLearner(SQUEEZE_NET_1_1, CIFAR10, n_start=100, n_new=100, epochs=50,
query_strategy='least_confident', experiment_name="test",
batch_size=50, lr=0.0001, weight_decay=0,
pretrained=False, data_aug=False)
active_learner(n_rounds=3)