Skip to content

Commit

Permalink
test:change seed to same value for all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michiboo committed Aug 29, 2023
1 parent 530822d commit a572b17
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion python/tests/e2e_v2/assert_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def assert_prediction_with_generated_data(job, **kwargs):
break
except:
pass
dataFile = data_func_obj(*kwargs["data_func"]["params"].values())
dataFile = data_func_obj(**kwargs["data_func"]["params"])
with open(dataFile, "r") as f:
for line in f.readlines():
expected_class.append(line.split("|")[0].strip())
Expand Down
2 changes: 1 addition & 1 deletion python/tests/e2e_v2/classification/data_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def generate_classification_data(
num_classes,
num_features,
classify_func,
bounds=None,
seed=random.randint(0, 100),
bounds=None,
):
random.seed(seed)
dataFile = f"classification_{num_classes}_{num_features}_{num_example}.txt"
Expand Down
22 changes: 15 additions & 7 deletions python/tests/e2e_v2/test_configs/cb.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"num_examples": 100,
"num_features": 1,
"num_actions": 2,
"seed" : 1,
"reward_function": {
"name": "constant_reward",
"params": {
Expand All @@ -18,10 +19,12 @@
},
"logging_policy": {
"name": "even_probability",
"params": {
}
"params": {}
},
"context_name": ["1", "2"]
"context_name": [
"1",
"2"
]
}
},
"assert_functions": [
Expand Down Expand Up @@ -112,6 +115,7 @@
"num_examples": 100,
"num_features": 1,
"num_actions": 1,
"seed" : 1,
"reward_function": {
"name": "fixed_reward",
"params": {}
Expand All @@ -125,7 +129,8 @@
{
"name": "assert_loss",
"params": {
"expected_loss": -1
"expected_loss": -1,
"decimal": 1
}
},
{
Expand Down Expand Up @@ -165,16 +170,19 @@
"num_examples": 100,
"num_features": 2,
"num_actions": 2,
"seed" : 1,
"reward_function": {
"name": "fixed_reward_two_action",
"params": {}
},
"logging_policy": {
"name": "even_probability",
"params": {
}
"params": {}
},
"context_name": ["1", "2"]
"context_name": [
"1",
"2"
]
}
},
"assert_functions": [
Expand Down
3 changes: 3 additions & 0 deletions python/tests/e2e_v2/test_configs/cb_cont.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"params": {
"num_examples": 100,
"num_features": 1,
"seed" : 1,
"action_range": [
0,
2
Expand Down Expand Up @@ -71,6 +72,7 @@
"params": {
"num_examples": 100,
"num_features": 2,
"seed" : 1,
"action_range": [
0,
2
Expand Down Expand Up @@ -137,6 +139,7 @@
"params": {
"num_examples": 10,
"num_features": 1,
"seed" : 1,
"action_range": [
0,
1
Expand Down
12 changes: 8 additions & 4 deletions python/tests/e2e_v2/test_configs/classification.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"num_example": 2000,
"num_classes": 2,
"num_features": 1,
"seed" : 1,
"classify_func": {
"name": "binary_classification_one_feature",
"params": {}
Expand All @@ -27,12 +28,13 @@
"name": "generate_classification_data",
"params": {
"num_example": 100,
"no_class": 2,
"no_features": 1,
"num_classes": 2,
"num_features": 1,
"classify_func": {
"name": "binary_classification_one_feature",
"params": {}
}
},
"seed" : 1
}
},
"accuracy_threshold": 0.9
Expand Down Expand Up @@ -63,7 +65,8 @@
"classify_func": {
"name": "multi_classification_two_features",
"params": {}
}
},
"seed" : 1
}
},
"assert_functions": [
Expand All @@ -76,6 +79,7 @@
"num_example": 500,
"num_classes": 25,
"num_features": 2,
"seed" : 1,
"classify_func": {
"name": "multi_classification_two_features",
"params": {}
Expand Down
3 changes: 2 additions & 1 deletion python/tests/e2e_v2/test_configs/regression.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"no_sample": 2000,
"constant": 5,
"x_lower_bound": 1,
"x_upper_bound": 100
"x_upper_bound": 100,
"seed" : 1
}
},
"assert_functions": [
Expand Down
1 change: 1 addition & 0 deletions python/tests/e2e_v2/test_configs/slate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"name": "generate_slate_data",
"params": {
"num_examples": 1000,
"seed" : 1,
"reward_function": {
"name": "reverse_reward_after_threshold",
"params": {
Expand Down

0 comments on commit a572b17

Please sign in to comment.