Skip to content

Commit bdd90c5

Browse files
authored
Notebook fixes (#149)
1 parent 94344e4 commit bdd90c5

File tree

2 files changed

+34
-42
lines changed

2 files changed

+34
-42
lines changed

.env.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
77
VERSION=0.1.0
88
METRICS_CRON=*/15 * * * *
99

10-
MODEL_PATH=models
10+
MODEL_PATH=models

examples/notebooks/sdk-example.ipynb

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
"cell_type": "markdown",
66
"metadata": {},
77
"source": [
8-
"# Usaging Whitebox SDK\n",
8+
"# Use of Whitebox SDK\n",
99
"\n",
1010
"First of all we need to import the Whitebox class:"
1111
]
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 1,
15+
"execution_count": null,
1616
"metadata": {},
1717
"outputs": [],
1818
"source": [
@@ -29,11 +29,11 @@
2929
},
3030
{
3131
"cell_type": "code",
32-
"execution_count": 2,
32+
"execution_count": 4,
3333
"metadata": {},
3434
"outputs": [],
3535
"source": [
36-
"wb = Whitebox(host=\"http://127.0.0.1:8000\", api_key=\"1073a9a03e5c6bf06b3f7a0c23d44ff923842a63dc75929ff0543705bbd3fa26\")"
36+
"wb = Whitebox(host=\"http://127.0.0.1:8000\", api_key=\"69ca68d71f804cbb00ef6c741768769f2b7bdf6bc43aec1a55d0386709e51a8e\")"
3737
]
3838
},
3939
{
@@ -48,27 +48,23 @@
4848
},
4949
{
5050
"cell_type": "code",
51-
"execution_count": 3,
51+
"execution_count": 5,
5252
"metadata": {},
5353
"outputs": [
5454
{
5555
"data": {
5656
"text/plain": [
57-
"{'id': '5dce48be-a16f-45dc-a878-d80b5b02a1f2',\n",
58-
" 'created_at': '2023-01-17T15:02:27.356199',\n",
59-
" 'updated_at': '2023-01-17T15:02:27.356199',\n",
57+
"{'id': 'dae9007d-894f-4f19-9772-7b7048a86347',\n",
58+
" 'created_at': '2023-02-24T14:11:36.400473',\n",
59+
" 'updated_at': '2023-02-24T14:11:36.400473',\n",
6060
" 'name': 'Model 1',\n",
6161
" 'description': '',\n",
6262
" 'type': 'binary',\n",
63-
" 'features': {'additionalProp1': 'numerical',\n",
64-
" 'additionalProp2': 'numerical',\n",
65-
" 'target': 'numerical'},\n",
66-
" 'labels': {'additionalProp1': 0, 'additionalProp2': 1},\n",
67-
" 'prediction': 'y_prediction_multi',\n",
68-
" 'probability': 'proba'}"
63+
" 'target_column': 'y_prediction_multi',\n",
64+
" 'labels': {'additionalProp1': 0, 'additionalProp2': 1}}"
6965
]
7066
},
71-
"execution_count": 3,
67+
"execution_count": 5,
7268
"metadata": {},
7369
"output_type": "execute_result"
7470
}
@@ -87,33 +83,29 @@
8783
},
8884
{
8985
"cell_type": "code",
90-
"execution_count": 4,
86+
"execution_count": 6,
9187
"metadata": {},
9288
"outputs": [
9389
{
9490
"data": {
9591
"text/plain": [
96-
"{'id': '5dce48be-a16f-45dc-a878-d80b5b02a1f2',\n",
97-
" 'created_at': '2023-01-17T15:02:27.356199',\n",
98-
" 'updated_at': '2023-01-17T15:02:27.356199',\n",
92+
"{'id': 'dae9007d-894f-4f19-9772-7b7048a86347',\n",
93+
" 'created_at': '2023-02-24T14:11:36.400473',\n",
94+
" 'updated_at': '2023-02-24T14:11:36.400473',\n",
9995
" 'name': 'Model 1',\n",
10096
" 'description': '',\n",
10197
" 'type': 'binary',\n",
102-
" 'features': {'additionalProp1': 'numerical',\n",
103-
" 'additionalProp2': 'numerical',\n",
104-
" 'target': 'numerical'},\n",
105-
" 'labels': {'additionalProp1': 0, 'additionalProp2': 1},\n",
106-
" 'prediction': 'y_prediction_multi',\n",
107-
" 'probability': 'proba'}"
98+
" 'target_column': 'y_prediction_multi',\n",
99+
" 'labels': {'additionalProp1': 0, 'additionalProp2': 1}}"
108100
]
109101
},
110-
"execution_count": 4,
102+
"execution_count": 6,
111103
"metadata": {},
112104
"output_type": "execute_result"
113105
}
114106
],
115107
"source": [
116-
"wb.get_model(\"5dce48be-a16f-45dc-a878-d80b5b02a1f2\")"
108+
"wb.get_model(\"dae9007d-894f-4f19-9772-7b7048a86347\")"
117109
]
118110
},
119111
{
@@ -130,7 +122,7 @@
130122
},
131123
{
132124
"cell_type": "code",
133-
"execution_count": 5,
125+
"execution_count": 11,
134126
"metadata": {},
135127
"outputs": [
136128
{
@@ -139,16 +131,16 @@
139131
"True"
140132
]
141133
},
142-
"execution_count": 5,
134+
"execution_count": 11,
143135
"metadata": {},
144136
"output_type": "execute_result"
145137
}
146138
],
147139
"source": [
148140
"import pandas as pd\n",
149-
"df = pd.read_csv(\"src/analytics/data/testing/classification_test_data.csv\")\n",
141+
"df = pd.read_csv(\"whitebox/analytics/data/testing/classification_test_data.csv\")\n",
150142
"\n",
151-
"wb.log_training_dataset(model_id=\"5dce48be-a16f-45dc-a878-d80b5b02a1f2\", processed=df, non_processed=df)"
143+
"wb.log_training_dataset(model_id=\"dae9007d-894f-4f19-9772-7b7048a86347\", processed=df, non_processed=df)"
152144
]
153145
},
154146
{
@@ -163,7 +155,7 @@
163155
},
164156
{
165157
"cell_type": "code",
166-
"execution_count": 6,
158+
"execution_count": 12,
167159
"metadata": {},
168160
"outputs": [
169161
{
@@ -172,18 +164,18 @@
172164
"True"
173165
]
174166
},
175-
"execution_count": 6,
167+
"execution_count": 12,
176168
"metadata": {},
177169
"output_type": "execute_result"
178170
}
179171
],
180172
"source": [
181173
"import pandas as pd\n",
182174
"from whitebox.tests.v1.mock_data import timestamps, mixed_actuals\n",
183-
"df = pd.read_csv(\"src/analytics/data/testing/classification_test_data.csv\")\n",
175+
"df = pd.read_csv(\"whitebox/analytics/data/testing/classification_test_data.csv\")\n",
184176
"\n",
185177
"\n",
186-
"wb.log_inferences(model_id=\"5dce48be-a16f-45dc-a878-d80b5b02a1f2\", processed=df, non_processed=df, timestamps=timestamps, actuals=mixed_actuals)"
178+
"wb.log_inferences(model_id=\"dae9007d-894f-4f19-9772-7b7048a86347\", processed=df, non_processed=df, timestamps=timestamps, actuals=mixed_actuals)"
187179
]
188180
},
189181
{
@@ -227,7 +219,7 @@
227219
},
228220
{
229221
"cell_type": "code",
230-
"execution_count": 7,
222+
"execution_count": 13,
231223
"metadata": {},
232224
"outputs": [
233225
{
@@ -236,19 +228,19 @@
236228
"True"
237229
]
238230
},
239-
"execution_count": 7,
231+
"execution_count": 13,
240232
"metadata": {},
241233
"output_type": "execute_result"
242234
}
243235
],
244236
"source": [
245-
"wb.delete_model(\"5dce48be-a16f-45dc-a878-d80b5b02a1f2\")"
237+
"wb.delete_model(\"dae9007d-894f-4f19-9772-7b7048a86347\")"
246238
]
247239
}
248240
],
249241
"metadata": {
250242
"kernelspec": {
251-
"display_name": ".venv",
243+
"display_name": "Python 3.10.8",
252244
"language": "python",
253245
"name": "python3"
254246
},
@@ -262,12 +254,12 @@
262254
"name": "python",
263255
"nbconvert_exporter": "python",
264256
"pygments_lexer": "ipython3",
265-
"version": "3.8.6"
257+
"version": "3.10.8"
266258
},
267259
"orig_nbformat": 4,
268260
"vscode": {
269261
"interpreter": {
270-
"hash": "6b8a8ae524dcca06b04542d2d49be160be0f11dd19d43d7b2673d555344c6092"
262+
"hash": "4de3d24b14351dd1d776fcd4034cd3e8d8527433466e9293dd76189fddd35128"
271263
}
272264
}
273265
},

0 commit comments

Comments
 (0)