Below you will find pages that utilize the taxonomy term “Bigquery”
BigQuery ML Example
Here is an example of how to use BigQuery ML on a public dataset to create a logistic regression model to predict whether a user will click on an ad:
# Import the BigQuery ML library
from google.cloud import bigquery
from google.cloud.bigquery import Model
# Get the dataset and table
dataset = bigquery.Dataset("bigquery-public-data.samples.churn")
table = dataset.table("churn")
# Create a model
model = Model('my_model',
model_type='logistic_regression',
input_label_column='churn',
input_features_columns=['tenure', 'contract', 'monthly_charges'])
# Train the model
model.train(table)
# Make a prediction
prediction = model.predict(STRUCT(tenure=12, contract='month-to-month', monthly_charges=100))
# Print the prediction
print(prediction)
This code will first create a logistic regression model named my_model
. The model will be trained on a public dataset called bigquery-public-data.samples.churn
. The churn
dataset contains data about customer churn, with the churn
column indicating whether a customer has churned. The tenure
, contract
, and monthly_charges
columns are the input features columns.
BigQuery ML and Vertex AI Generative AI
BigQuery ML and Vertex AI Generative AI (GenAI) are both machine learning (ML) services that can be used to build and deploy ML models. However, there are some key differences between the two services.
- BigQuery ML: BigQuery ML is a fully managed ML service that allows you to build and deploy ML models without having to manage any infrastructure. BigQuery ML uses the same machine learning algorithms as Vertex AI, but it does not offer the same level of flexibility or control.
- Vertex AI Generative AI: Vertex AI Generative AI is a managed ML service that offers a wider range of generative AI models than BigQuery ML. Vertex AI Generative AI also offers more flexibility and control over the ML model training process.
If you are looking for a fully managed ML service that is easy to use, then BigQuery ML is a good option. If you need more flexibility and control over the ML model training process, then Vertex AI Generative AI is a better option.