All skills
google avatar

/bigquery-ai-ml

@d6b9f75
by googlegoogle/skills21k stars
1,698

Leverages BigQuery's built-in machine learning and GenAI capabilities for advanced data analytics. Use when you need to write SQL queries that perform time-series forecasting, predict values, detect outliers or anomalies, find key drivers, perform semantic search or vector search, classify text, calculate similarity, summarize content, translate language, evaluate models, filter by semantic conditions, measure the causal effect of an intervention, compute correlations between columns, detect change points or structural breaks, extract trend or seasonality components, or leverage generative AI capabilities in BigQuery. Do not use for general BigQuery dataset, table, or job management requests.

Use this Skill: https://skilld.dev/gh/google/skills/bigquery-ai-ml

This session only. Nothing lands on disk.

referencesai_evaluate.md

≈557 tokens on demand. Your agent reads this file only when SKILL.md points to it.

AI.EVALUATE

Evaluates the accuracy of a forecasting model by comparing predicted values against actual historical data. It computes standard regression metrics like MAE, MSE, and RMSE.

Syntax

SELECT
  *
FROM
  AI.EVALUATE(
    { TABLE `project.dataset.history_table` | (HISTORY_QUERY) },
    { TABLE `project.dataset.actual_table` | (ACTUAL_QUERY) },
    data_col => 'DATA_COL',
    timestamp_col => 'TIMESTAMP_COL'
    [, model => 'MODEL']
    [, id_cols => ID_COLS]
    [, horizon => HORIZON]
  )

Input Arguments

Argument Requirement Type Description
history_data Required The table or query containing historical data used for the forecast.
actual_data Required The table or query containing the actual "ground truth" data.
data_col Required String The numeric column to evaluate.
timestamp_col Required String The column containing dates/timestamps.
id_cols Optional Array<String> Grouping columns for multiple series.
horizon Optional Int64 Number of points to evaluate. Defaults to 1024.
model Optional String Model version (e.g., 'TimesFM 2.0').

Output Schema

Column Type Description
id_cols (As Input) Original identifiers for the series (if provided).
mean_absolute_error FLOAT64 Average magnitude of errors in the predictions.
mean_squared_error FLOAT64 Average of the squares of the errors.
root_mean_squared_error FLOAT64 Square root of the mean squared error.
mean_absolute_percentage_error FLOAT64 Mean absolute percentage error for the series.
symmetric_mean_absolute_percentage_error FLOAT64 Symmetric mean absolute percentage error for the series.
ai_evaluate_status STRING Error messages or empty string on success.

Example: Evaluating Forecast Quality

SELECT * FROM AI.EVALUATE(
  (SELECT * FROM `sales` WHERE date < '2024-01-01'),
  (SELECT * FROM `sales` WHERE date >= '2024-01-01'),
  data_col => 'total_sales',
  timestamp_col => 'date',
  id_cols => ['store_id']
);

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    This skill provides a comprehensive reference for BigQuery's built-in AI and machine learning functions. It includes a security consideration regarding potential indirect prompt injection when processing untrusted data with generative AI functions. These patterns are standard for the intended data analysis use cases and can be managed through proper prompt design and data validation.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at d6b9f75. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
metadata
{
  "version": "1.1.0",
  "category": "AiAndMachineLearning"
}

README badge

README badge for google/skills/bigquery-ai-ml