本頁面中的部分或全部資訊可能不適用於 Trusted Cloud by S3NS。
分群總覽
分群法是一種非監督式機器學習技術,可用來將相似的記錄歸類。當您想瞭解資料中的群組或叢集,但沒有標記資料可用於訓練模型時,這項方法就很實用。舉例來說,如果您有未標示的捷運票券購買資料,可以依票券購買時間將資料分組,進一步瞭解哪些時段的捷運使用量最高。詳情請參閱「什麼是叢集?」。
k-means 模型廣泛用於執行分群作業。您可以使用 k-means 模型搭配 ML.PREDICT
函式分群資料,或搭配 ML.DETECT_ANOMALIES
函式執行異常偵測。
k-means 模型會使用以群集中心為基礎的分群,將資料分組成各個叢集。如要取得 k-means 模型群集中心的相關資訊,您可以使用 ML.CENTROIDS
函式。
建議的知識
只要使用 CREATE MODEL
陳述式和推論函式中的預設設定,即使您沒有太多機器學習知識,也能建立及使用叢集模型。不過,如果您具備機器學習開發和聚類模型的基本知識,就能同時最佳化資料和模型,進而獲得更優異的結果。建議您參考下列資源,熟悉機器學習技術和程序:
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-17 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-17 (世界標準時間)。"],[[["\u003cp\u003eClustering is an unsupervised machine learning technique that groups similar records together, useful for understanding data patterns without labeled training data.\u003c/p\u003e\n"],["\u003cp\u003eK-means models, a widely used clustering method, can be used with \u003ccode\u003eML.PREDICT\u003c/code\u003e to cluster data or with \u003ccode\u003eML.DETECT_ANOMALIES\u003c/code\u003e for anomaly detection.\u003c/p\u003e\n"],["\u003cp\u003eK-means models utilize centroid-based clustering, and information about a model's centroids can be obtained using the \u003ccode\u003eML.CENTROIDS\u003c/code\u003e function.\u003c/p\u003e\n"],["\u003cp\u003eWhile you can create and use clustering models with default settings without extensive machine learning knowledge, basic familiarity with ML and clustering models can improve results.\u003c/p\u003e\n"]]],[],null,["# Clustering overview\n===================\n\nClustering is an unsupervised machine learning technique you can use to group\nsimilar records together. It is a useful approach for when you want to\nunderstand what groups or clusters you have in your data, but don't have\nlabeled data to train a model on. For example, if you had unlabeled data about\nsubway ticket purchases, you could cluster that data by ticket purchase time to\nbetter understand what time periods have the heaviest subway usage. For more\ninformation, see\n[What is clustering?](https://developers.google.com/machine-learning/clustering/overview)\n\n[K-means models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-kmeans)\nare widely used to perform clustering. You can use k-means models with the\n[`ML.PREDICT` function](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict)\nto cluster data, or with the\n[`ML.DETECT_ANOMALIES` function](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-detect-anomalies)\nto perform [anomaly detection](/bigquery/docs/anomaly-detection-overview).\n\nK-means models use\n[centroid-based clustering](https://developers.google.com/machine-learning/clustering/clustering-algorithms#centroid-based_clustering) to organize data into clusters.\nTo get information about a k-mean model's centroids, you can use the\n[`ML.CENTROIDS` function](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-centroids).\n\nRecommended knowledge\n---------------------\n\nBy using the default settings in the `CREATE MODEL` statements and the\ninference functions, you can create and use a clustering model even\nwithout much ML knowledge. However, having basic knowledge about\nML development, and clustering models in particular,\nhelps you optimize both your data and your model to\ndeliver better results. We recommend using the following resources to develop\nfamiliarity with ML techniques and processes:\n\n- [Machine Learning Crash Course](https://developers.google.com/machine-learning/crash-course)\n- [Intro to Machine Learning](https://www.kaggle.com/learn/intro-to-machine-learning)\n- [Intermediate Machine Learning](https://www.kaggle.com/learn/intermediate-machine-learning)\n- [Clustering](https://developers.google.com/machine-learning/clustering)"]]