如要在 BigQuery ML 中訓練模型及執行批次推論作業,您可以使用「時間點正確性」一節所述的其中一個時間點查詢函式來擷取特徵。您可以將這些函式加入訓練時 CREATE MODEL 陳述式的 query_statement 子句,或是放送時適當的資料表值函式 (例如 ML.PREDICT) 的 query_statement 子句。
使用 Vertex AI 特徵儲存庫提供特徵
如要為在 Vertex AI 中註冊的 BigQuery ML 模型提供特徵,您可以使用 Vertex AI 特徵儲存庫。Vertex AI 特徵儲存庫會在 BigQuery 的特徵資料表上運作,以低延遲的方式管理及提供特徵。您可以使用線上服務即時擷取特徵,用於線上預測,也可以使用離線服務擷取特徵,用於模型訓練。
如要進一步瞭解如何準備 BigQuery 特徵資料,以便在 Vertex AI 特徵儲存庫中使用,請參閱「準備資料來源」。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eFeatures must be saved in BigQuery tables before they can be used for BigQuery ML model training and inference.\u003c/p\u003e\n"],["\u003cp\u003eIncluding a timestamp column in feature tables allows for point-in-time correctness, preventing data leakage between training and serving.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eML.FEATURES_AT_TIME\u003c/code\u003e and \u003ccode\u003eML.ENTITY_FEATURES_AT_TIME\u003c/code\u003e functions are used to specify point-in-time cutoffs when retrieving time-sensitive features.\u003c/p\u003e\n"],["\u003cp\u003eBigQuery ML models can use point-in-time lookup functions in \u003ccode\u003eCREATE MODEL\u003c/code\u003e statements or in table-valued functions like \u003ccode\u003eML.PREDICT\u003c/code\u003e to retrieve features for training and batch inference.\u003c/p\u003e\n"],["\u003cp\u003eVertex AI Feature Store can be used to manage and serve features with low latency for BigQuery ML models registered in Vertex AI, supporting both real-time online prediction and offline model training.\u003c/p\u003e\n"]]],[],null,["# Feature serving\n===============\n\nThis document describes your options for making\n[features](/bigquery/docs/preprocess-overview) available for BigQuery ML\nmodel training and inference. For all options, you must save the features in\nBigQuery tables as a prerequisite first step.\n\nPoint-in-time correctness\n-------------------------\n\nThe data used to train a model often has time dependencies built into it. When\nyou create a feature table for time sensitive features, include a timestamp\ncolumn to represent the feature values as they existed at a given time for each\nrow. You can then use point-in-time lookup functions when querying data from\nthese feature tables in order to ensure that there is no [data\nleakage](https://en.wikipedia.org/wiki/Leakage_(machine_learning)) between\ntraining and serving. This process enables point-in-time correctness.\n\nUse the following functions to specify point-in-time cutoffs when retrieving\ntime sensitive features:\n\n- [`ML.FEATURES_AT_TIME`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-feature-time)\n- [`ML.ENTITY_FEATURES_AT_TIME`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-entity-feature-time)\n\nServe features in BigQuery ML\n-----------------------------\n\nTo train models and perform batch inference in BigQuery ML, you\ncan retrieve features using one of the point-in-time lookup functions described\nin the [Point-in-time correctness](#point-in-time_correctness) section. You can\ninclude these functions in the\n[`query_statement` clause](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create#query_statement) of the `CREATE MODEL` statement for\ntraining, or in the `query_statement` clause of the appropriate table-valued\nfunction, such as\n[`ML.PREDICT`](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict),\nfor serving.\n\nServe features with Vertex AI Feature Store\n-------------------------------------------\n\nTo serve features to BigQuery ML models that are\n[registered in Vertex AI](/bigquery/docs/managing-models-vertex#register_models),\nyou can use\n[Vertex AI Feature Store](/vertex-ai/docs/featurestore/latest/overview).\nVertex AI Feature Store works on top of feature tables in\nBigQuery to manage and serve features with low latency. You can\nuse [online serving](/vertex-ai/docs/featurestore/latest/serve-feature-values)\nto retrieve features in real time for online prediction, and you can use\n[offline serving](/vertex-ai/docs/featurestore/latest/serve-historical-features)\nto retrieve features for model training.\n\nFor more information about preparing BigQuery feature data\nto be used in Vertex AI Feature Store, see\n[Prepare data source](/vertex-ai/docs/featurestore/latest/prepare-data-source)."]]