Skip to content

Commit 16a8180

Browse files
committed
fix(getting-started.ipynb): fix the notebook to work with newer version 🫣
1 parent 2f97891 commit 16a8180

File tree

1 file changed

+58
-43
lines changed

1 file changed

+58
-43
lines changed

docs/docs/getting-started.ipynb

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,38 @@
9696
"from typing_extensions import TypedDict"
9797
],
9898
"metadata": {
99-
"id": "a5eW89kWTdL5"
99+
"id": "a5eW89kWTdL5",
100+
"outputId": "f9cd22e0-8adf-46d6-e550-4e85fd5352b0",
101+
"colab": {
102+
"base_uri": "https://localhost:8080/"
103+
}
100104
},
101-
"execution_count": 15,
102-
"outputs": []
105+
"execution_count": 1,
106+
"outputs": [
107+
{
108+
"output_type": "stream",
109+
"name": "stdout",
110+
"text": [
111+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m51.1/51.1 kB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
112+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m40.8/40.8 MB\u001b[0m \u001b[31m15.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
113+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m985.1/985.1 kB\u001b[0m \u001b[31m17.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
114+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.5/57.5 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
115+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m200.6/200.6 kB\u001b[0m \u001b[31m8.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
116+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m135.3/135.3 kB\u001b[0m \u001b[31m6.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
117+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.3/57.3 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
118+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m100.0/100.0 kB\u001b[0m \u001b[31m7.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
119+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.1/53.1 kB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
120+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m68.9/68.9 kB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
121+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.8/60.8 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
122+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m19.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
123+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.6/45.6 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
124+
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m1.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
125+
"\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
126+
"ibis-framework 8.0.0 requires pyarrow<16,>=2, but you have pyarrow 16.0.0 which is incompatible.\u001b[0m\u001b[31m\n",
127+
"\u001b[0m"
128+
]
129+
}
130+
]
103131
},
104132
{
105133
"cell_type": "markdown",
@@ -131,7 +159,7 @@
131159
"metadata": {
132160
"id": "25sRcwoMwtR_"
133161
},
134-
"execution_count": 16,
162+
"execution_count": 2,
135163
"outputs": []
136164
},
137165
{
@@ -146,7 +174,7 @@
146174
"metadata": {
147175
"id": "aUqlADgYbcmr"
148176
},
149-
"execution_count": 17,
177+
"execution_count": 3,
150178
"outputs": []
151179
},
152180
{
@@ -161,14 +189,14 @@
161189
"metadata": {
162190
"id": "xcHrGi2Nbmh4"
163191
},
164-
"execution_count": 18,
192+
"execution_count": 4,
165193
"outputs": []
166194
},
167195
{
168196
"cell_type": "markdown",
169197
"source": [
170198
"---\n",
171-
"> ## 😎 *Cool tip* \n",
199+
"> ## 😎 *Cool tip*\n",
172200
">\n",
173201
"> You can use the `@runtime` decorator to specify packages you want to install and use.\n",
174202
">\n",
@@ -197,14 +225,14 @@
197225
")\n",
198226
"class Deal(TypedDict):\n",
199227
" id: int\n",
200-
" event_at: pd.Timestamp\n",
228+
" event_at: datetime\n",
201229
" account_id: str\n",
202230
" amount: float"
203231
],
204232
"metadata": {
205233
"id": "L0oPJvDgdKSY"
206234
},
207-
"execution_count": 19,
235+
"execution_count": 5,
208236
"outputs": []
209237
},
210238
{
@@ -223,7 +251,7 @@
223251
"metadata": {
224252
"id": "1xuZOPyayKHT"
225253
},
226-
"execution_count": 20,
254+
"execution_count": 6,
227255
"outputs": []
228256
},
229257
{
@@ -253,7 +281,7 @@
253281
"metadata": {
254282
"id": "WOmMn2bxynMp"
255283
},
256-
"execution_count": 21,
284+
"execution_count": 7,
257285
"outputs": []
258286
},
259287
{
@@ -277,7 +305,7 @@
277305
"metadata": {
278306
"id": "7XEUpCv_d1iS"
279307
},
280-
"execution_count": 22,
308+
"execution_count": 8,
281309
"outputs": []
282310
},
283311
{
@@ -294,7 +322,7 @@
294322
"metadata": {
295323
"id": "Dp1PzC9Xd27X"
296324
},
297-
"execution_count": 23,
325+
"execution_count": 9,
298326
"outputs": []
299327
},
300328
{
@@ -331,45 +359,32 @@
331359
" # Split the data into training and testing sets\n",
332360
" X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0)\n",
333361
"\n",
362+
" # Transform y_train to a 1D array\n",
363+
" y_train = y_train.values.ravel()\n",
364+
"\n",
334365
" # Initialize an XGBoost model\n",
335366
" xgb_model = XGBClassifier()\n",
336367
"\n",
337368
" # Fit the model to the training data\n",
338369
" from sklearn.preprocessing import LabelEncoder\n",
339370
" le = LabelEncoder()\n",
340-
" y_train = le.fit_transform(y_train)\n",
341-
" xgb_model.fit(X_train, y_train)\n",
371+
"\n",
372+
" # Initialize the LabelEncoder\n",
373+
" le = LabelEncoder()\n",
374+
" y_train_encoded = le.fit_transform(y_train)\n",
375+
"\n",
376+
" # Fit the model with the encoded labels\n",
377+
" xgb_model.fit(X_train, y_train_encoded)\n",
342378
"\n",
343379
" return xgb_model\n",
344380
"\n",
345381
"deal_prediction.export()"
346382
],
347383
"metadata": {
348-
"id": "tNeaKZGMErJ4",
349-
"outputId": "a8de2b44-caf3-4020-c4bb-4cfd6b7376d4",
350-
"colab": {
351-
"base_uri": "https://localhost:8080/"
352-
}
384+
"id": "tNeaKZGMErJ4"
353385
},
354-
"execution_count": 25,
355-
"outputs": [
356-
{
357-
"output_type": "stream",
358-
"name": "stderr",
359-
"text": [
360-
"/usr/local/lib/python3.9/dist-packages/sklearn/preprocessing/_label.py:116: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel().\n",
361-
" y = column_or_1d(y, warn=True)\n",
362-
"ERROR:bentoml._internal.bento.build_config:Failed to lock PyPI packages: Command '['/usr/bin/python3', '-m', 'piptools', 'compile', '/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.txt', '--quiet', '--allow-unsafe', '--no-header', '--output-file=/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.lock.txt', '--resolver=backtracking']' returned non-zero exit status 2.\n",
363-
"Traceback (most recent call last):\n",
364-
" File \"/usr/local/lib/python3.9/dist-packages/bentoml/_internal/bento/build_config.py\", line 662, in write_to_bento\n",
365-
" subprocess.check_call(cmd)\n",
366-
" File \"/usr/lib/python3.9/subprocess.py\", line 373, in check_call\n",
367-
" raise CalledProcessError(retcode, cmd)\n",
368-
"subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'piptools', 'compile', '/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.txt', '--quiet', '--allow-unsafe', '--no-header', '--output-file=/tmp/tmp_0g5eaqqbentoml_bento_default.deal_prediction/env/python/requirements.lock.txt', '--resolver=backtracking']' returned non-zero exit status 2.\n",
369-
"ERROR:bentoml._internal.bento.build_config:Falling back to using the user-provided package requirement specifiers, which is equivalent to 'lock_packages=false'.\n"
370-
]
371-
}
372-
]
386+
"execution_count": 10,
387+
"outputs": []
373388
},
374389
{
375390
"cell_type": "markdown",
@@ -393,17 +408,17 @@
393408
"base_uri": "https://localhost:8080/"
394409
},
395410
"id": "8ESVUlESq3QC",
396-
"outputId": "7e83d9ac-4421-40e2-d68f-502f281239fb"
411+
"outputId": "667c80f4-391f-4f87-8784-841136e02062"
397412
},
398-
"execution_count": 26,
413+
"execution_count": 11,
399414
"outputs": [
400415
{
401416
"output_type": "stream",
402417
"name": "stdout",
403418
"text": [
404419
"make: Entering directory '/content/out'\n",
405-
"make: aws: Command not found\n",
406-
"make: aws: Command not found\n",
420+
"make: aws: No such file or directory\n",
421+
"make: aws: No such file or directory\n",
407422
"\u001b[38;5;97m █▀\n",
408423
"\u001b[38;5;97m █▀ █▀\n",
409424
"\u001b[38;5;97m▄ ██▀ ▄█▀ ▄\n",

0 commit comments

Comments
 (0)