Skip to content

Commit 087a32a

Browse files
authored
chore: add notebook showcasing LinearRegression on large data (#1613)
* chore: add notebook to support medium blog on linear regression * change the modeling problem to o3 level prediction * train the model in partial ordering mode * fix typo * use 2025 instead of 2023 in the copyright header
1 parent 93f44a8 commit 087a32a

File tree

3 files changed

+1087
-18
lines changed

3 files changed

+1087
-18
lines changed

notebooks/ml/bq_dataframes_ml_linear_regression.ipynb

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@
3535
"<table align=\"left\">\n",
3636
"\n",
3737
" <td>\n",
38-
" <a href=\"https://colab.research.google.com/github/googleapis/python-bigquery-dataframes/blob/main/notebooks/regression/bq_dataframes_ml_linear_regression.ipynb\">\n",
38+
" <a href=\"https://colab.research.google.com/github/googleapis/python-bigquery-dataframes/blob/main/notebooks/ml/bq_dataframes_ml_linear_regression.ipynb\">\n",
3939
" <img src=\"https://cloud.google.com/ml-engine/images/colab-logo-32px.png\" alt=\"Colab logo\"> Run in Colab\n",
4040
" </a>\n",
4141
" </td>\n",
4242
" <td>\n",
43-
" <a href=\"https://github.com/googleapis/python-bigquery-dataframes/blob/main/notebooks/regression/bq_dataframes_ml_linear_regression.ipynb\">\n",
43+
" <a href=\"https://github.com/googleapis/python-bigquery-dataframes/blob/main/notebooks/ml/bq_dataframes_ml_linear_regression.ipynb\">\n",
4444
" <img src=\"https://cloud.google.com/ml-engine/images/github-logo-32px.png\" alt=\"GitHub logo\">\n",
4545
" View on GitHub\n",
4646
" </a>\n",
4747
" </td>\n",
4848
" <td>\n",
49-
" <a href=\"https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/googleapis/python-bigquery-dataframes/blob/main/notebooks/regression/bq_dataframes_ml_linear_regression.ipynb\">\n",
49+
" <a href=\"https://console.cloud.google.com/vertex-ai/workbench/deploy-notebook?download_url=https://raw.githubusercontent.com/googleapis/python-bigquery-dataframes/blob/main/notebooks/ml/bq_dataframes_ml_linear_regression.ipynb\">\n",
5050
" <img src=\"https://lh3.googleusercontent.com/UiNooY4LUgW_oTvpsNhPpQzsstV5W8F7rYgxgGBD85cWJoLmrOzhVs_ksK_vgx40SHs7jCqkTkCk=e14-rj-sc0xffffff-h130-w32\" alt=\"Vertex AI logo\">\n",
5151
" Open in Vertex AI Workbench\n",
5252
" </a>\n",
5353
" </td>\n",
5454
" <td>\n",
55-
" <a href=\"https://console.cloud.google.com/bigquery/import?url=https://github.com/googleapis/python-bigquery-dataframes/blob/main/notebooks/regression/bq_dataframes_ml_linear_regression.ipynb\">\n",
55+
" <a href=\"https://console.cloud.google.com/bigquery/import?url=https://github.com/googleapis/python-bigquery-dataframes/blob/main/notebooks/ml/bq_dataframes_ml_linear_regression.ipynb\">\n",
5656
" <img src=\"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTW1gvOovVlbZAIZylUtf5Iu8-693qS1w5NJw&s\" alt=\"BQ logo\" width=\"35\">\n",
5757
" Open in BQ Studio\n",
5858
" </a>\n",
@@ -79,7 +79,7 @@
7979
"source": [
8080
"## Overview\n",
8181
"\n",
82-
"Use this notebook to learn how to train a linear regression model by using BigQuery DataFrames ML. BigQuery DataFrames ML provides a provides a scikit-learn-like API for ML powered by the BigQuery engine.\n",
82+
"Use this notebook to learn how to train a linear regression model using BigQuery DataFrames ML. BigQuery DataFrames ML provides a provides a scikit-learn-like API for ML powered by the BigQuery engine.\n",
8383
"\n",
8484
"This example is adapted from the [BQML linear regression tutorial](https://cloud.google.com/bigquery-ml/docs/linear-regression-tutorial).\n",
8585
"\n",
@@ -142,7 +142,10 @@
142142
"source": [
143143
"## Installation\n",
144144
"\n",
145-
"Install the following packages, which are required to run this notebook:"
145+
"If you don't have [bigframes](https://pypi.org/project/bigframes/) package already installed, uncomment and execute the following cells to\n",
146+
"\n",
147+
"1. Install the package\n",
148+
"1. Restart the notebook kernel (Jupyter or Colab) to work with the package"
146149
]
147150
},
148151
{
@@ -153,18 +156,7 @@
153156
},
154157
"outputs": [],
155158
"source": [
156-
"!pip install bigframes"
157-
]
158-
},
159-
{
160-
"cell_type": "markdown",
161-
"metadata": {
162-
"id": "58707a750154"
163-
},
164-
"source": [
165-
"### Colab only\n",
166-
"\n",
167-
"Uncomment and run the following cell to restart the kernel:"
159+
"# !pip install bigframes"
168160
]
169161
},
170162
{
@@ -749,6 +741,18 @@
749741
"kernelspec": {
750742
"display_name": "Python 3",
751743
"name": "python3"
744+
},
745+
"language_info": {
746+
"codemirror_mode": {
747+
"name": "ipython",
748+
"version": 3
749+
},
750+
"file_extension": ".py",
751+
"mimetype": "text/x-python",
752+
"name": "python",
753+
"nbconvert_exporter": "python",
754+
"pygments_lexer": "ipython3",
755+
"version": "3.12.0"
752756
}
753757
},
754758
"nbformat": 4,

0 commit comments

Comments
 (0)