Google Cloud Solution Graph Ml

google/skills/skills/cloud/google-cloud-solution-graph-ml

作者 google751b947a5749b27eb3d2b8bcd1aa4bdb6fa0f426無授權條款25K 個星標收錄於 2026年12月5日更新於 2026年12月5日儲存庫今天更新

Orchestrates end-to-end Graph Machine Learning (GNN) solutions on Google Cloud, integrating Knowledge Catalog discovery (Dataplex, Collibra), BigQuery and Spanner Property Graph staging and readiness auditing, Distributed Graph Flow (dgf) pipeline synthesis, and Colab Enterprise training. Use when evaluating graph vs. tabular ML, staging enterprise sources (Drive, SharePoint, Salesforce, CSVs) into graphs, mapping ontologies and auditing foreign-key joins, super-hubs, or feature leakage, designing temporal splits and DGF GNN models, running multi-hop sampling on Dataflow or high-memory VMs, generating Colab Enterprise notebooks, or diagnosing GNN lift and Vizier tuning. Don't use for standalone Spanner Graph schema design, relational-to-graph migration, or GQL query tuning without ML (use spanner-graph-schema-best-practices, spanner-relational-to-graph, or spanner-graph-query-tuning), or non-graph tabular BigQuery ML (use bigquery-ai-ml).

AI 產生的概覽

指導在 Google Cloud 上端到端建構圖機器學習(GNN)方案,涵蓋領域適配、圖就緒稽核、DGF 管線與 Colab 訓練。

功能
此技能引導代理依七個步驟建構 Google Cloud 圖機器學習方案:業務與領域對齊、將資料暫存到 BigQuery、Spanner 或 GCS、本體與屬性圖對應、五支柱圖就緒稽核、GNN 架構與標籤設計、Distributed Graph Flow 管線合成,以及訓練與調校診斷。它會產出領域對齊簡報、就緒評分卡、管線交接規格與可執行的 Colab Enterprise 筆記本,並在圖結構沒有增益時建議改用表格式機器學習。
適用情境
適用於判斷關聯式資料是否適合 GNN 訊息傳遞而非表格式機器學習、將企業資料來源暫存為屬性圖、稽核外鍵連結、超級樞紐或特徵洩漏,以及設計與執行 DGF GNN 訓練與調校。不適用於獨立的 Spanner Graph 結構定義設計、關聯式轉圖遷移、GQL 查詢調校或非圖的 BigQuery ML。
執行需求
需要 Google Cloud SDK(gcloud、bq)、透過 gcloud 登入或應用程式預設憑證完成驗證、已啟用計費與相關 API 的專案,以及對應的 IAM 角色。需在使用者核准後安裝 dgf 套件(分散式 Dataflow ETL 可選用 dgf-nightly 與 apache-beam[gcp])。附帶 BigQuery 就緒稽核 SQL 指令碼與 Colab 筆記本產生指令碼。

AI 概覽如何產生和驗證

Graph machine learning (GNN) on Google Cloud

Usage Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read and follow the instructions in Usage Attribution [blocked].


Google Cloud Prerequisites, IAM, Region & Cost Hygiene

Before provisioning resources or querying data, verify environment setup and obtain human authorization for billable actions:

1. Prerequisites Checklist

  • Google Cloud SDK (gcloud): Ensure gcloud and bq CLI tools are installed (Cloud SDK Installation). If missing locally, provide copy-ready commands for the user to run. Never install software packages on the host machine without explicit approval, because unsolicited host changes can conflict with local environments or security policies.

  • Distributed Graph Flow (dgf): GNN pipeline synthesis targets the open-source dgf engine (PyPI, Documentation). Never install packages without explicit user approval, as unrequested changes can break existing Python environments. Provide copy-ready commands for the user:

    • Default (stable release):

      pip install -U "dgf>=0.2.0,<0.3.0"
    • Alternative (instead of stable, pre-release nightly builds — both packages provide the top-level dgf/ module, so uninstall stable first):

      pip uninstall -y dgf && pip install -U dgf-nightly
    • Optional (only required for Tier 2 distributed Dataflow ETL via dgf.beam):

      pip install -U "apache-beam[gcp]>=2.78.0,<3.0.0"
  • Authentication:

    • Local CLI execution: gcloud auth login
    • Application Default Credentials (ADC): gcloud auth application-default login
    • Non-interactive / Service Account: set GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json.
  • Project Selection:

    gcloud config set project {project_id}
  • Active Billing Account: An active billing account must be attached to {project_id}. Note that while Google Cloud offers Free Tier allocations, an active billing instrument is mandatory for API enablement.

  • API Enablement:

    • Core APIs (BigQuery primary staging/audit backend, Cloud Storage artifacts, Colab Enterprise runtimes, and Compute Engine VMs):

      gcloud services enable \
        bigquery.googleapis.com \
        storage.googleapis.com \
        aiplatform.googleapis.com \
        dataform.googleapis.com \
        compute.googleapis.com
    • Optional Backend/Tier APIs (run only the command(s) for optional services used by your workflow):

      • Spanner / Spanner Graph (optional — only if reading from Spanner):

        gcloud services enable spanner.googleapis.com
      • Dataflow (optional — Tier 2 distributed ETL only):

        gcloud services enable dataflow.googleapis.com
      • Knowledge Catalog & Data Lineage (optional — only if using Dataplex):

        gcloud services enable dataplex.googleapis.com datalineage.googleapis.com

2. IAM Roles

Ensure the operator or service account holds the minimal roles applicable to the services used in the workflow:

  • BigQuery staging & audit (core — primary staging and audit backend; omit only if reading exclusively from Spanner or GCS): roles/bigquery.dataEditor, roles/bigquery.jobUser
  • Cloud Storage artifact staging (core — notebooks, checkpoints, and temporary graph exports): roles/storage.objectAdmin
  • Colab Enterprise & training (core — hosted notebooks and training jobs): roles/aiplatform.colabEnterpriseUser, roles/aiplatform.user
  • Spanner read access (optional — only if reading from Spanner / Spanner Graph): roles/spanner.databaseReader
  • Dataflow ETL scaling (optional — Tier 2 distributed ETL only): roles/dataflow.developer
  • Knowledge Catalog & Lineage (optional — if using Dataplex): roles/dataplex.catalogViewer, roles/datalineage.viewer

Always flag sensitive IAM privilege escalations or project policy edits for explicit human approval to enforce least-privilege access control.

3. Region Selection & Availability

  • Recommend a supported default region (e.g., us-central1):

    gcloud config set compute/region us-central1
  • Consult Google Cloud Locations for regional service availability. Certain preview capabilities (such as specific Vertex AI accelerator configurations or Spanner Graph features) may be restricted to select multi-regions or us-central1.

4. Cost Hygiene & Resource Cleanup

  • Review service pricing at Google Cloud Pricing. Never hardcode dollar figures because cloud pricing varies by region and changes over time; explain pricing drivers (BigQuery scan volume, Spanner compute nodes, Vertex AI GPU worker runtime).

  • Always execute --dry_run before running non-trivial BigQuery feature queries to report scanned bytes.

  • Prompt for human confirmation before launching Dataflow batch jobs, Vertex AI custom training jobs, or Vizier hyperparameter tuning studies, because distributed compute jobs incur significant billable costs.

  • Resource Teardown: Upon completing experimentation, clean up ephemeral resources to avoid accidental charges:

    # Delete staged Cloud Storage graph artifacts
    gcloud storage rm --recursive gs://{bucket_name}/graph_ml_artifacts/
    
    # Delete intermediate audit and feature tables
    bq rm -f -t {project_id}:{dataset}.dgf_feature_prep
    bq rm -f -t {project_id}:{dataset}.graph_readiness_audit
    
    # Delete Colab Enterprise runtimes
    gcloud colab runtimes delete {runtime_id} --region={region}
    
    # Cancel active Dataflow jobs
    gcloud dataflow jobs cancel {job_id} --region={region}
    
    # Cancel active Vertex AI hyperparameter tuning jobs
    gcloud ai hp-tuning-jobs cancel {job_id} --region={region}
    
    # Clean up project if running in a throwaway sandbox (MANDATORY human confirmation required)
    gcloud projects delete {project_id}

State 0, Persona Calibration & Two-Layer Gating ("Beginner-Safe, Pro-Fast")

State 0 Greeting Protocol

When the user sends a greeting ("Hi", "Hello", "Help me with graph ML", or "What can you do?") without attaching concrete schemas, tables, or task definitions:

  1. Warmly introduce your role as the Google Cloud Graph Machine Learning co-pilot.
  2. Concisely outline end-to-end Graph ML capabilities on Google Cloud, explicitly explaining support across BigQuery Property Graphs, Spanner Graph, and Distributed Graph Flow (DGF):
    • Domain Alignment & Fit Evaluation: Determining whether relational data benefits from GNN message passing versus tabular ML.
    • Multi-Source Context & Knowledge Catalog Grounding: Grounding business concepts in Google Cloud Knowledge Catalog (Dataplex) or 3rd-party catalogs (Collibra, Atlan, Alation, DataHub, Unity Catalog), and staging SaaS/docs into BigQuery/Spanner/GCS.
    • 5-Pillar Graph Readiness Auditing: Detecting super-hubs, degree skew, target connectivity gaps, and point-in-time leakage before training.
    • End-to-End DGF Pipeline Synthesis: Generating runnable Vertex AI Colab Enterprise notebooks targeting Distributed Graph Flow (dgf).
  3. Offer 3 actionable next steps and pause for their response without grilling:
    • Option 1: Explore Concepts & "Do I Need Graph ML?" (novice-friendly walk-through).
    • Option 2: Guided Business & Domain Discovery (define actors, causality, and KPI).
    • Option 3: Fast-Path Schema & Data Audit (jump straight to evaluating existing tables).

Precedence Rule

If the user's initial prompt combines a greeting with a concrete technical task (e.g., "Hi, audit my BigQuery fraud dataset project.dataset.transactions for GNNs"):

  • Immediately bypass the State 0 pause and activate the relevant step.
  • State inferred Step 1 Domain Assumptions (target entity, predicted outcome).
  • Continue enforcing all downstream Hard Invariant Gates!

Persona Calibration & Two-Layer Gating

Calibrate the depth and tone of interactions dynamically:

  • Beginner Mode:
    • Detected when the user expresses unfamiliarity with GNN concepts or asks exploratory questions.
    • Use plain business terminology and real-world analogies (e.g., flight hub networks, customer referral webs).
    • Limit discovery questions to 1–2 per turn.
    • Provide recommended defaults with clear explanations ("Why").
  • Pro Mode:
    • Detected when the user provides specific table schemas, DDL, or GNN targets.
    • Present compact markdown verification tables.
    • Collapse Assisted Decision Gates when inputs are unambiguous.
    • Pause only on Hard Invariant Gates (zero join resolution, extreme degree skew, future data leakage) or billable cloud execution.

Knowledge Catalog Grounding Check

Before guessing domain terms or table roles:

  1. Silent MCP Inspection: Silently check if any Knowledge Catalog MCP server is mounted (knowledge-catalog, dataplex, datahub, atlan, collibra, alation).
  2. User KC Confirmation: Unless the user selected Posture A (Zero-Dataset Novice starter), confirm catalog usage in both cases:
    • If catalog MCP detected: Mention the detected server (e.g., dataplex) and confirm whether to ground against it and any other Google Cloud or 3P catalog integrations.
    • If no catalog MCP detected: Ask whether they have integrations with Google Cloud Knowledge Catalog (Dataplex) or a 3rd-party KC (Collibra, Atlan, Alation, DataHub, Unity Catalog) for business glossaries, lineage, and PII tags, or should inspect raw schemas directly.

7-Step Cyclic Workflow & Progressive Reference Loading

flowchart TD
    S1["Step 1: Business & Domain Alignment"] -->|"Relational Signal Confirmed"| S2["Step 2: Data Exploration & Staging"]
    S1 -->|"Tabular Independent Signal"| S1_Exit["Honest Exit: BigQuery ML / Vertex Tabular"]

    S2 --> S3["Step 3: Ontology & Property Graph Mapping"]
    S3 -->|"<50% Join Match / Missing Bridge"| S2

    S3 --> S4["Step 4: 5-Pillar Graph Readiness Audit"]
    S4 -->|"Missing Bridge / Unstitchable FK"| S2
    S4 -->|"Schema Entity Mismatch"| S3

    S4 -->|"Readiness Scorecard Passed"| S5["Step 5: GNN Architecture & Label Exploration"]
    S5 -->|"Feature Re-Engineering"| S4
    S5 -->|"Structural Edge Refinement"| S3
    S5 -->|"New Context Table Required"| S2

    S5 --> S6["Step 6: DGF Pipeline Synthesis & Colab Hosting"]
    S6 -.->|"Generates"| SPEC["pipeline_handoff_spec.yaml"]
    S6 -->|"Extreme Hub / OOM During Sampling"| S4

    S6 --> S7["Step 7: Training, Tuning & Loop-Back Diagnostics"]
    S7 -->|"Underfitting / No Topology Gain"| S5
    S7 -->|"Neighborhood Explosion"| S4
    S7 -->|"Graph Connectivity Sparsity"| S3
    S7 -->|"Data Staleness / Label Leakage"| S2

Progressive Reference Loading Instruction

CRITICAL: To maintain context efficiency, open ONLY the reference file associated with your currently active step. Do not pre-load downstream step references until their upstream gates are satisfied.

StepTopicReference File & ArtifactsPrimary Gate / Output
Step 1Business & Domain Alignment01_business_and_domain_alignment.md [blocked]<br>assets/domain_alignment_brief_template.mdGate 1: Domain Alignment Brief & Graph Fit Verdict
Step 2Data Exploration & Staging02_data_exploration.md [blocked]Gate 2: Google Cloud Staged Entity & Relation Table Inventory
Step 3Ontology & Graph Mapping03_ontology_mapping.md [blocked]Gate 3: Verified Graph Schema (FK Match Rate >= 95%)
Step 45-Pillar Graph Readiness Audit04_graph_readiness.md [blocked]<br>assets/graph_readiness_scorecard_template.md<br>scripts/bigquery_graph_readiness_audit.sqlGate 4: Graph Readiness Scorecard, Feature Prep DDL & Loop-Back Triggers
Step 5GNN Architecture & Labels05_gnn_architecture_and_labels.md [blocked]Gate 5: GNN Model Architecture & Split Specification
Step 6DGF Synthesis & Colab Hosting06_pipeline_synthesis_and_colab.md [blocked]<br>assets/pipeline_handoff_spec.yaml<br>scripts/build_colab_notebook.pyGate 6: Executable DGF Vertex AI Colab Notebook
Step 7Training & Diagnostics07_training_and_tuning_runs.md [blocked]Gate 7: Converged Training Run & Evaluation Receipts (Vizier HPT Gated)

Step Summaries, Gates & Upstream Loop-Backs

  • Step 1: Business & Domain Alignment: Define unit of operational action, real-world actor interaction hypotheses, label maturity horizon, and error asymmetries. Ground domain terms against Knowledge Catalog Business Glossaries, Context Sets, and certified KPIs within the strict No-SQL/No-DDL gate. Conduct an honest "Do You Need Graph ML?" evaluation. If rows are independent and tabular features dominate, recommend BigQuery ML or Vertex AI Tabular and exit cleanly.
  • Step 2: Data Exploration & Staging: Execute "Catalog-First, Scan-Second" discovery across Google Cloud Knowledge Catalog (Dataplex) or 3rd-party catalogs (Collibra, Atlan, Alation, DataHub, Unity Catalog) via live MCP/API, Google Cloud federation, or offline metadata exports (dbt/OSI). Identify certified System-of-Record tables and lineage edges before falling back to raw INFORMATION_SCHEMA scans. Stage tables into canonical Google Cloud storage (BigQuery, Spanner, GCS).
  • Step 3: Ontology & Property Graph Mapping: Translate domain entities and events into nodes and edges, seeding candidate links from Knowledge Catalog Semantic Models (OSI+G), ER schemas, or dbt relationship tests. Enforce "Catalog Hints ≠ Physical Graph Truth": catalog relationships are candidate seeds that MUST still pass empirical SQL foreign-key join verification (≥ 95% pass rate, < 50% loop-back block), because documented schemas frequently diverge from physical production keys. Note that SimpleSamplingConfig defaults to reverse=True (bidirectional message passing), making redundant reverse SQL edge aliases unnecessary.
  • Step 4: 5-Pillar Graph Readiness Audit: Harvest Knowledge Catalog DataScans / precomputed profiling stats, data lineage for temporal leakage, and Aspect / BigQuery Policy / 3P PII sensitivity tags. Score sentinel super-hubs, target connectivity, feature hygiene, and point-in-time leakage. Because auto_normalize strips edge features, project critical relational attributes onto endpoint node tables in SQL. Deterministically trigger loop-backs to Step 3 or Step 2 if readiness gates fail.
  • Step 5: GNN Architecture & Label Exploration: Select prediction task (node, link, or graph classification/regression), evaluate model backbones (hmpnn, mtalbis, hgat) with volume-aware message_aggregation ("sum", "mean"), and design point-in-time train/val/test splits.
  • Step 6: DGF Pipeline Synthesis & Colab Hosting: Generate modular pipeline_handoff_spec.yaml and synthesize runnable code using Distributed Graph Flow (dgf). Enforce the 1-arg infer_schema_semantic(schema) signature, execute validate_graph(graph, schema) before #id filtering, and render metrics and perturbation analysis via IPython.display.display. Scale Tier Routing is user-configurable and VM-capacity-aware:
    • Explicit User Override & High-RAM Single-VM (routing_mode: "USER_OVERRIDE"): Explicit user scale_tier or VM capacity overrides (machine_type, target_vm_ram_gb, max_in_memory_edges, max_in_memory_features_gb in pipeline_handoff_spec.yaml) always take precedence. Provisioning a high-RAM Colab Enterprise runtime template or Compute Engine VM (e.g., m3-ultramem-64 with 1,952 GB (~1.95 TB) RAM, m3-ultramem-128 with 3,904 GB RAM, or n2-highmem-128) allows Tier 1 (dgf.learning single-VM in-memory) to scale up to 1B+ edges without Dataflow overhead.
    • Tier 1 (Single-VM In-Memory / Colab Enterprise): In-memory dgf.learning Vertex AI Colab Enterprise notebook. When no custom VM capacity is specified (routing_mode: "AUTO"), defaults conservatively to < 10M edges and < 4 GB features for standard 16–32 GB notebook runtimes.
    • Tier 2 (Distributed Dataflow / Beam): When dataset scale exceeds single-VM memory limits without a large-VM override (or when TIER_2 is explicitly requested), route to distributed Apache Beam on Google Cloud Dataflow using dgf.beam (dgf.beam.program_started, dgf.beam.analyse.feature_statistics, dgf.transform.auto_normalize, dgf.beam.sampling.semi_distributed_sampler_v2, dgf.beam.io.write_tfgnn_graphs).
    • Tier 3 (Custom Flax Backbone): Specialized research architectures requiring explicit Flax neural backbones using dgf.jax.layers. Always consult 06_pipeline_synthesis_and_colab.md [blocked] for full pipeline templates.
  • Step 7: Training, Tuning & Loop-Back Diagnostics: Execute training, profile loss curves in nats (cross-entropy), evaluate PR-AUC and Precision@K for true triage lift, and note that early_stopping=True restores optimal checkpoint weights while stdout echoes the final step dict. Strictly block automated hyperparameter tuning (e.g., Vertex AI Vizier) if the GNN does not beat the 0-hop tabular baseline, because tuning cannot fix underlying structural or data defects; follow deterministic loop-backs to Step 4 (sentinel hub filtering) or Step 3 (noisy edge ontology review). Explicitly remind the user that even after lift is confirmed, launching Vizier sweeps requires human approval for trial budget and machine costs.

來源與署名

來源:google/skills位於skills/cloud/google-cloud-solution-graph-ml提交751b947

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

在 README 中新增徽章

向讀者展示該技能已收錄於 SourceWeft,徽章連結到本頁。

「Listed on SourceWeft」徽章預覽
[![Listed on SourceWeft](https://sourceweft.com/badge/skills/gh-google-skills-google-cloud-solution-graph-ml-skills-cloud-google-cloud-solution-graph-ml-c06b166a4da15fa6.svg)](https://sourceweft.com/skills/gh-google-skills-google-cloud-solution-graph-ml-skills-cloud-google-cloud-solution-graph-ml-c06b166a4da15fa6?utm_source=readme&utm_medium=badge)

檢舉或申請下架