Skip to content

Commit 8b993b3

Browse files
matthew29tangcopybara-github
authored andcommitted
docs: Add Bigframes remote training example to vertexai README
PiperOrigin-RevId: 580621887
1 parent 755c3f9 commit 8b993b3

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

vertexai/preview/README.md

+51-1
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,40 @@ tuner.fit(X_train, y_train)
305305
best_model = tuner.get_best_models()[0]
306306
```
307307

308+
## Remote Training with BigFrames data source
309+
Remote training supports [BigFrames](https://cloud.google.com/python/docs/reference/bigframes/latest) as the input data source. The user journey is identical to remote training for a given framework after the BigFrames dataframe is passed in as arguments for the train function.
310+
311+
### Supported frameworks
312+
1. scikit-learn
313+
2. tensorflow
314+
3. pytorch
315+
316+
### User journey
317+
```py
318+
import vertexai
319+
import bigframes.pandas as bf
320+
from bigframes.ml.model_selection import train_test_split as bf_train_test_split
321+
322+
# Init vertexai and switch to remote mode for tuning
323+
vertexai.init(project="my-project", location="my-location")
324+
vertexai.preview.init(remote=True)
325+
326+
# Load the table into a bigframe dataframe
327+
df = bf.read_gbq("mydataset.mytable")
328+
329+
feature_columns = df[["x_col1", "x_col2", "x_col3"]]
330+
label_columns = df[["y_col"]]
331+
332+
# Use bigframes split method to create train and test datasets
333+
X_train, X_test, y_train, y_test = bf_train_test_split(
334+
feature_columns, label_columns, test_size=0.2
335+
)
336+
337+
# Continue with the framework of your choice
338+
# X_train and y_train are bigframes dataframe
339+
model.train(X_train, y_train)
340+
```
341+
308342

309343
## Sample Notebooks
310344
The notebooks below showcase the different usage of Vertex AI SDK.
@@ -328,4 +362,20 @@ The notebooks below showcase the different usage of Vertex AI SDK.
328362
- Remote training
329363

330364
- [remote_hyperparameter_tuning.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_hyperparameter_tuning.ipynb)
331-
- Vizier Hyperparameter Tuning
365+
- Vizier Hyperparameter Tuning
366+
367+
- [remote_training_bigframes_sklearn.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_training_bigframes_sklearn.ipynb)
368+
- BigFrames data ingestion
369+
- Remote training
370+
- Remote prediction
371+
372+
- [remote_training_bigframes_pytorch.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_training_bigframes_pytorch.ipynb)
373+
- BigFrames data ingestion
374+
- Remote training
375+
- Remote prediction
376+
377+
- [remote_training_bigframes_tensorflow.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_training_bigframes_tensorflow.ipynb)
378+
- BigFrames data ingestion
379+
- Remote training
380+
- Remote GPU training
381+
- Remote prediction

0 commit comments

Comments
 (0)