BigQuery AI/ML 高级分析
bigquery-ai-ml
利用 BigQuery 内置的机器学习和 GenAI 能力进行高级数据分析。当您需要编写 SQL 查询来执行以下任务时使用:时间序列预测、数值预测、检测异常值或异常、找出关键驱动因素、语义搜索或向量搜索、文本分类、计算相似度、内容摘要、语言翻译、模型评估、按语义条件过滤、衡量干预措施的因果效应、计算列之间的相关性、生成描述性统计和表分布概况、检测变化点或结构性突变、提取趋势或季节性成分,或在 BigQuery 中利用生成式 AI 能力。不用于常规的 BigQuery 数据集、表或作业管理请求。
- License 许可
- Apache-2.0
- 所属仓库
- google/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 2.4w
- Forks
- 2.0k
01 前言 Front Matter
- name
- bigquery-ai-ml
- metadata
- { "version": "1.1.2", "category": "AiAndMachineLearning", "publisher": "google" }
- description
- 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, generate descriptive statistics and table distribution profiles, 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.
02 资源文件 24
- 参考文档references/ai_agg.md3.5 KB
- 参考文档references/ai_causal_effect.md11.2 KB
- 参考文档references/ai_classify.md3.7 KB
- 参考文档references/ai_detect_anomalies.md5.0 KB
- 参考文档references/ai_evaluate.md2.2 KB
- 参考文档references/ai_forecast.md11.1 KB
- 参考文档references/ai_generate_embedding.md2.0 KB
- 参考文档references/ai_generate_table.md3.3 KB
- 参考文档references/ai_generate.md3.4 KB
- 参考文档references/ai_if.md2.0 KB
- 参考文档references/ai_key_drivers.md4.6 KB
- 参考文档references/ai_predict.md8.5 KB
- 参考文档references/ai_score.md1.9 KB
- 参考文档references/ai_search.md3.7 KB
- 参考文档references/ai_similarity.md2.7 KB
- 参考文档references/attribution.md1.8 KB
- 参考文档references/ml_contribution_analysis.md4.8 KB
- 参考文档references/ml_correlation.md8.9 KB
- 参考文档references/ml_describe_data.md5.1 KB
- 参考文档references/ml_detect_change_points.md5.5 KB
- 参考文档references/ml_seasonality.md6.6 KB
- 参考文档references/ml_trend.md4.1 KB
- 参考文档references/remote_models.md1.1 KB
- 参考文档references/vector_search.md4.0 KB
03 SKILL.md 正文
BigQuery AI & ML
BigQuery integrates with Vertex AI to provide powerful machine learning and
generative AI capabilities directly within SQL queries using built-in functions
like AI.FORECAST, AI.KEY_DRIVERS, AI.DETECT_ANOMALIES, and AI.GENERATE.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:bigquery-ai-ml)"
and append agent-skills/1.0 (skill:bigquery-ai-ml) to User-Agent headers.
Function Selection & Reference Directory
| Function | Reference | SQL Shape | Requires CREATE MODEL or CREATE VECTOR INDEX? |
When to Use & Disambiguation |
|---|---|---|---|---|
AI.AGG |
ai_agg.md | Aggregate |
No | Multi-row semantic aggregation with GROUP BY; synthesizes one summary string across many rows (unlike per-row AI.GENERATE). |
AI.CAUSAL_EFFECT |
ai_causal_effect.md | TVF |
No | Quantifies counterfactual post-intervention impact on a time series after a specific treatment timestamp. |
AI.CLASSIFY |
ai_classify.md | Scalar |
No | Semantic classification of text or multimodal unstructured data into predefined category labels. |
AI.DETECT_ANOMALIES |
ai_detect_anomalies.md | TVF |
No | Zero-shot TimesFM detector for isolated time-series point anomalies/outliers (use ML.DETECT_CHANGE_POINTS for sustained shifts). |
AI.EVALUATE |
ai_evaluate.md | TVF |
No | Zero-shot TimesFM time-series forecast evaluation/backtesting against a historical holdout split. |
AI.FORECAST |
ai_forecast.md | TVF |
No | Zero-shot TimesFM time-series forecasting without training a custom model. |
AI.GENERATE |
ai_generate.md | Scalar |
No | Default for per-row LLM text or multimodal structured extraction (output_schema); returns STRUCT. Prefer over AI.GENERATE_TABLE. |
AI.GENERATE_EMBEDDING |
ai_generate_embedding.md | TVF |
Yes | Batch generates ARRAY<FLOAT64> vector embeddings for text or visual content using a remote embedding model. |
AI.GENERATE_TABLE |
ai_generate_table.md | TVF |
Yes | Table-valued structured extraction (FROM clause); only use instead of AI.GENERATE when a remote model + TVF is explicitly needed. |
AI.IF |
ai_if.md | Scalar |
No | Evaluates boolean semantic conditions (BOOL) on text or multimodal data for WHERE/CASE/JOIN filtering (do not use AI.GENERATE_TABLE). |
AI.KEY_DRIVERS |
ai_key_drivers.md | TVF |
No | Default one-step attribution of dimensional segments driving metric changes (interest_label_col TRUE vs. FALSE). Prefer over CONTRIBUTION_ANALYSIS. |
AI.PREDICT |
ai_predict.md | TVF |
No | Zero-shot TabFM foundation model for tabular classification or regression without training and managing custom models. |
AI.SCORE |
ai_score.md | Scalar |
No | Assigns a continuous FLOAT64 semantic score to text or multimodal data for ranking or sorting (ORDER BY). |
AI.SEARCH |
ai_search.md | TVF |
No | Simplified semantic search using a raw string query on tables with autonomous background embeddings (AI.EMBED generated column). |
AI.SIMILARITY |
ai_similarity.md | Scalar |
No | Computes an on-the-fly semantic similarity score (FLOAT64) between two text or multimodal inputs without stored embeddings. |
Remote Models |
remote_models.md | CREATE MODEL |
Yes | Creates a Vertex AI REMOTE WITH CONNECTION DEFAULT model entity for functions that require one (AI.GENERATE_TABLE, AI.GENERATE_EMBEDDING, VECTOR_SEARCH). |
CONTRIBUTION_ANALYSIS |
ml_contribution_analysis.md | CREATE MODEL |
Yes | Model-based driver analysis (CREATE MODEL ... OPTIONS(MODEL_TYPE='CONTRIBUTION_ANALYSIS') + ML.GET_INSIGHTS). Use AI.KEY_DRIVERS unless a MODEL entity is required. |
ML.CORRELATION |
ml_correlation.md | TVF |
No | Calculates statistical correlation coefficients between numeric columns, optionally sliced by dimensions. |
ML.DESCRIBE_DATA |
ml_describe_data.md | TVF |
No | Generates descriptive statistics (e.g., count, mean, median, min, max, stddev, quantiles, nulls, top values) for columns in a table or subquery. |
ML.DETECT_CHANGE_POINTS |
ml_detect_change_points.md | TVF |
No | Detects structural breaks or sustained shifts ([begin_timestamp, end_timestamp] intervals) in a time series. |
ML.SEASONALITY |
ml_seasonality.md | TVF |
No | Extracts recurring periodic/seasonal components from a historical time series. |
ML.TREND |
ml_trend.md | TVF |
No | Extracts the smoothed long-term trend component from a historical time series. |
VECTOR_SEARCH |
vector_search.md | TVF |
Yes | Searches pre-computed ARRAY<FLOAT64> embedding columns between a base table and query table (paired with AI.GENERATE_EMBEDDING, unlike AI.SEARCH). |
Related Skills
- BigQuery Basics Skill: SKILL.md file for core BigQuery concepts, resource management, CLI, and client libraries.
04 同仓库更多 Skills
cloud-operator-share-context
Shares Google Cloud operating context the user or their team already have — environments, projects, services and regions, product preferences, best practices, architecture guidance, runbooks — found in agent instruction files, local memory, skills and workflows, and the repository's GCP docs, with the operator agent's memory after the user reviews the list. Use when the user runs this skill, accepts the cloud-operator or cloud-operator-setup skill's offer to share their existing Google Cloud context, or asks to share, import or save that context or a GCP fact for the operator agent. Don't use for ordinary GCP requests, which go to the cloud-operator skill.
cloud-operator-setup
Sets up the operator agent in a Google Cloud project via the autocloud MCP server: picks the operator project, creates or checks the user's operator agent, saves the project, and offers to share the user's existing Google Cloud operating context with the operator agent's memory. Use when the user runs this skill, asks to set up the operator or create their operator agent, or chooses setup when the cloud-operator skill asks. Don't use for ordinary GCP requests or installing gcloud.
developer-device-platform-device-run
Runs automated, non-interactive jobs on remote Android devices with Developer Device Platform (DDP) Device Run using `gcloud beta device-run sessions`: native Android executables or shell scripts (for example CLI tools, custom runners, test harnesses or benchmarks) and Android instrumentation tests, on one or many devices, then waits for completion and collects per-device outputs and logs. Use when running a binary or test suite on remote devices without an interactive connection. Don't use it for interactive device reservations, adb tunnels or screen streaming (use developer-device-platform-basics), or for local devices.
compute-vm-creation
Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Standard clusters, Kubernetes node pools or Pods, container orchestration, managing existing VMs, Managed Instance Groups (MIGs), or Instance Templates.
agent-platform-autorater-customization
Customizes an autorater (evaluation metric) for an AI agent so its grades match the user's own judgment, starting from the agent's real trajectories. Use when a user wants a metric tailored to their agent, wants to turn failing trajectories into rubrics, says an existing autorater grades their agent wrong, or wants an autorater to agree with human labels (autorater hillclimbing, judge calibration). Don't use for quick evals with built-in metrics or for improving the agent itself (use agent-platform-eval-flywheel).
iap-agent-platform-troubleshooting
Diagnoses Identity-Aware Proxy (IAP) denials of outbound requests from Gemini Enterprise Agent Platform agents that run on Agent Runtime and send traffic through Agent Gateway. Use when an agent request fails with "Egress request is not authorized", when Cloud Audit Logs show an IAP egressViaIAP decision with granted false, when IAP audit entries are missing while debugging agent egress, or when Access policies, IAP allow policies, policy bindings, or Agent Registry entries might block agent egress. Don't use for Gemini model IAM permission errors (such as aiplatform.endpoints.predict), Agent Platform API errors, or Agent Runtime deployment or 500 errors (use agent-platform-troubleshooting instead). Don't use for setting up, creating, or connecting an Agent Gateway, or for IAP web apps, IAP TCP forwarding, or SSH.