本页面上的部分或全部信息可能不适用于 Trusted Cloud by S3NS。
分类概览
机器学习的一个常见用例是使用基于类似标记数据训练的模型对新数据进行分类。例如,您可能希望预测电子邮件是否为垃圾邮件,或者客户对产品的评价是正面、负面还是中立。
您可以将以下任一模型与 ML.PREDICT
函数结合使用来执行分类:
推荐的知识
通过使用 CREATE MODEL
语句和 ML.PREDICT
函数中的默认设置,即使您没有太多机器学习方面的知识,也可以创建和使用分类模型。不过,掌握机器学习开发方面的基本知识有助于您优化数据和模型,从而取得更好的成效。我们建议您使用以下资源熟悉机器学习技术和流程:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):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"]],["最后更新时间 (UTC):2025-08-17。"],[[["\u003cp\u003eMachine learning classification involves using a model trained on labeled data to classify new data, such as identifying spam emails or categorizing customer reviews.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eML.PREDICT\u003c/code\u003e function can be used with various classification models, including logistic regression, boosted tree, random forest, deep neural network (DNN), wide & deep, and AutoML models.\u003c/p\u003e\n"],["\u003cp\u003eDifferent models can be specified using the \u003ccode\u003eMODEL_TYPE\u003c/code\u003e option, such as \u003ccode\u003eLOGISTIC_REG\u003c/code\u003e, \u003ccode\u003eBOOSTED_TREE_CLASSIFIER\u003c/code\u003e, \u003ccode\u003eRANDOM_FOREST_CLASSIFIER\u003c/code\u003e, \u003ccode\u003eDNN_CLASSIFIER\u003c/code\u003e, \u003ccode\u003eDNN_LINEAR_COMBINED_CLASSIFIER\u003c/code\u003e, and \u003ccode\u003eAUTOML_CLASSIFIER\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eWhile classification models can be created and used without extensive ML knowledge, understanding the basics can help optimize both data and the model for better results.\u003c/p\u003e\n"],["\u003cp\u003eResources like the Machine Learning Crash Course, Intro to Machine Learning, and Intermediate Machine Learning are recommended for gaining familiarity with machine learning techniques.\u003c/p\u003e\n"]]],[],null,["# Classification overview\n=======================\n\nA common use case for machine learning is classifying new data by using a model\ntrained on similar labeled data. For example, you might want to predict whether\nan email is spam, or whether a customer product review is positive, negative, or\nneutral.\n\nYou can use any of the following models in combination with the\n[`ML.PREDICT` function](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-predict)\nto perform classification:\n\n- [Logistic regression models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-glm): use [logistic regression](https://developers.google.com/machine-learning/crash-course/logistic-regression) by setting the `MODEL_TYPE` option to `LOGISTIC_REG`.\n- [Boosted tree models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-boosted-tree): use a [gradient boosted decision tree](https://developers.google.com/machine-learning/decision-forests/intro-to-gbdt) by setting the `MODEL_TYPE` option to `BOOSTED_TREE_CLASSIFIER`.\n- [Random forest models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-random-forest): use a [random forest](https://developers.google.com/machine-learning/decision-forests/intro-to-decision-forests) by setting the `MODEL_TYPE` option to `RANDOM_FOREST_CLASSIFIER`.\n- [Deep neural network (DNN) models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-dnn-models): use a [neural network](https://developers.google.com/machine-learning/crash-course/neural-networks) by setting the `MODEL_TYPE` option to `DNN_CLASSIFIER`.\n- [Wide \\& Deep models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-wnd-models): use [wide \\& deep learning](https://dl.acm.org/doi/10.1145/2988450.2988454) by setting the `MODEL_TYPE` option to `DNN_LINEAR_COMBINED_CLASSIFIER`.\n- [AutoML models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-automl): use an [AutoML classification model](/vertex-ai/docs/tabular-data/classification-regression/overview) by setting the `MODEL_TYPE` option to `AUTOML_CLASSIFIER`.\n\nRecommended knowledge\n---------------------\n\nBy using the default settings in the `CREATE MODEL` statements and the\n`ML.PREDICT` function, you can create and use a classification model even\nwithout much ML knowledge. However, having basic knowledge about\nML development helps 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)"]]