Skip to content

Commit

Permalink
docs: Add Bigframes remote training example to vertexai README
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 580621887
  • Loading branch information
matthew29tang authored and Copybara-Service committed Nov 8, 2023
1 parent 755c3f9 commit 8b993b3
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion vertexai/preview/README.md
Expand Up @@ -305,6 +305,40 @@ tuner.fit(X_train, y_train)
best_model = tuner.get_best_models()[0]
```

## Remote Training with BigFrames data source
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.

### Supported frameworks
1. scikit-learn
2. tensorflow
3. pytorch

### User journey
```py
import vertexai
import bigframes.pandas as bf
from bigframes.ml.model_selection import train_test_split as bf_train_test_split

# Init vertexai and switch to remote mode for tuning
vertexai.init(project="my-project", location="my-location")
vertexai.preview.init(remote=True)

# Load the table into a bigframe dataframe
df = bf.read_gbq("mydataset.mytable")

feature_columns = df[["x_col1", "x_col2", "x_col3"]]
label_columns = df[["y_col"]]

# Use bigframes split method to create train and test datasets
X_train, X_test, y_train, y_test = bf_train_test_split(
feature_columns, label_columns, test_size=0.2
)

# Continue with the framework of your choice
# X_train and y_train are bigframes dataframe
model.train(X_train, y_train)
```


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

- [remote_hyperparameter_tuning.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_hyperparameter_tuning.ipynb)
- Vizier Hyperparameter Tuning
- Vizier Hyperparameter Tuning

- [remote_training_bigframes_sklearn.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_training_bigframes_sklearn.ipynb)
- BigFrames data ingestion
- Remote training
- Remote prediction

- [remote_training_bigframes_pytorch.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_training_bigframes_pytorch.ipynb)
- BigFrames data ingestion
- Remote training
- Remote prediction

- [remote_training_bigframes_tensorflow.ipynb](https://github.com/GoogleCloudPlatform/vertex-ai-samples/blob/main/notebooks/official/vertex_ai_sdk/remote_training_bigframes_tensorflow.ipynb)
- BigFrames data ingestion
- Remote training
- Remote GPU training
- Remote prediction

0 comments on commit 8b993b3

Please sign in to comment.