forked from recommenders-team/recommenders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_notebooks_python.py
100 lines (78 loc) · 2.89 KB
/
test_notebooks_python.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
import papermill as pm
from tests.notebooks_common import OUTPUT_NOTEBOOK, KERNEL_NAME
@pytest.mark.notebooks
def test_template_runs(notebooks):
notebook_path = notebooks["template"]
pm.execute_notebook(
notebook_path,
OUTPUT_NOTEBOOK,
parameters=dict(PM_VERSION=pm.__version__),
kernel_name=KERNEL_NAME,
)
nb = pm.read_notebook(OUTPUT_NOTEBOOK)
df = nb.dataframe
assert df.shape[0] == 2
check_version = df.loc[df["name"] == "checked_version", "value"].values[0]
assert check_version is True
@pytest.mark.notebooks
def test_sar_single_node_runs(notebooks):
notebook_path = notebooks["sar_single_node"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)
@pytest.mark.notebooks
def test_sar_deep_dive_runs(notebooks):
notebook_path = notebooks["sar_deep_dive"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)
@pytest.mark.notebooks
def test_baseline_deep_dive_runs(notebooks):
notebook_path = notebooks["baseline_deep_dive"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)
@pytest.mark.notebooks
def test_surprise_deep_dive_runs(notebooks):
notebook_path = notebooks["surprise_svd_deep_dive"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)
@pytest.mark.vw
@pytest.mark.notebooks
def test_vw_deep_dive_runs(notebooks):
notebook_path = notebooks["vowpal_wabbit_deep_dive"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)
@pytest.mark.notebooks
def test_lightgbm(notebooks):
notebook_path = notebooks["lightgbm_quickstart"]
pm.execute_notebook(
notebook_path,
OUTPUT_NOTEBOOK,
kernel_name=KERNEL_NAME,
parameters=dict(
MAX_LEAF=32,
MIN_DATA=20,
NUM_OF_TREES=10,
TREE_LEARNING_RATE=0.15,
EARLY_STOPPING_ROUNDS=20,
METRIC="auc",
),
)
@pytest.mark.notebooks
def test_wikidata_runs(notebooks, tmp):
notebook_path = notebooks["wikidata_knowledge_graph"]
MOVIELENS_SAMPLE_SIZE = 5
pm.execute_notebook(
notebook_path,
OUTPUT_NOTEBOOK,
kernel_name=KERNEL_NAME,
parameters=dict(
MOVIELENS_DATA_SIZE="100k",
MOVIELENS_SAMPLE=True,
MOVIELENS_SAMPLE_SIZE=MOVIELENS_SAMPLE_SIZE,
),
)
@pytest.mark.notebooks
def test_rlrmc_quickstart_runs(notebooks):
notebook_path = notebooks["rlrmc_quickstart"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)
@pytest.mark.notebooks
def test_cornac_deep_dive_runs(notebooks):
notebook_path = notebooks["cornac_bpr_deep_dive"]
pm.execute_notebook(notebook_path, OUTPUT_NOTEBOOK, kernel_name=KERNEL_NAME)