[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eOverfitting, where a model closely matches training data but performs poorly on new data, is a common issue in BigQuery ML model training.\u003c/p\u003e\n"],["\u003cp\u003eBigQuery ML uses early stopping by default, which halts training when the improvement in loss on holdout data falls below a certain threshold.\u003c/p\u003e\n"],["\u003cp\u003eRegularization, which prevents model weights from becoming too large, is another method for preventing overfitting in BigQuery ML, offering L1 and L2 options.\u003c/p\u003e\n"],["\u003cp\u003eWhen using regularization, disabling early stopping can help clarify the effects of regularization, and if there are more features than observations in the training set, you can try using larger regularization values.\u003c/p\u003e\n"],["\u003cp\u003eUsing L1 regularization is beneficial for potentially identifying irrelevant features and creating smaller, more effective models because it tends to push many model weights to zero.\u003c/p\u003e\n"]]],[],null,["# Prevent overfitting\n===================\n\nA common pitfall when training a BigQuery ML model is [overfitting](https://developers.google.com/machine-learning/glossary/#overfitting). Overfitting occurs when the model matches the\ntraining data too closely, causing it to perform poorly on new data.\nBigQuery ML supports two methods for preventing overfitting: [early stopping](https://developers.google.com/machine-learning/glossary/#early_stopping) and [regularization](https://developers.google.com/machine-learning/glossary/#regularization).\n\nTo learn how to modify the options described below, see\n[the `CREATE MODEL` statement](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create#model_option_list).\n\nEarly stopping\n--------------\n\nEarly stopping is the default option for overfitting prevention in\nBigQuery ML. When early stopping is enabled, the\n[loss](https://developers.google.com/machine-learning/glossary/#loss) on the\n[holdout data](https://developers.google.com/machine-learning/glossary/#holdout_data) is monitored during training, and\ntraining is halted once the loss improvement in the latest iteration falls below\na threshold. Since the holdout data is not used during training, it is a good\nestimate of the model's loss on new data. The `early_stop`, `min_rel_progress`,\n`data_split_method`, and `data_split_eval_fraction` options control the behavior\nof early stopping.\n\nRegularization\n--------------\n\nRegularization keeps the [model weights](https://developers.google.com/machine-learning/glossary/#weight)\nfrom growing too large, preventing the model from matching the training data too\nclosely. BigQuery ML supports two methods for controlling the size of\nthe model weights: [L1\nregularization](https://developers.google.com/machine-learning/glossary/#L1_regularization) and [L2\nregularization](https://developers.google.com/machine-learning/glossary/#L2_regularization).\n\nBy default, the values of `l1_reg` and `l2_reg` are zero, which disables\nregularization. On some datasets, setting positive values for `l1_reg` and\n`l2_reg` will improve the trained model's performance on new data. The best\nvalues for the regularization parameters are typically found through trial-and-\nerror, and it is common to experiment with values across several orders of\nmagnitude (for example, 0.01, 0.1, 1, 10, and 100).\n\nHere is some general advice on using regularization:\n\n- If you are experimenting with the regularization parameters, try disabling\n early stopping so that the effect of regularization is clear.\n\n- If the number of features is large compared to the size of the training set,\n try large values for the regularization parameters. The risk of overfitting is\n greater when there are only a few observations per feature.\n\n- If you are concerned that many features may be irrelevant for predicting the\n label, try setting `l1_reg` to be larger than `l2_reg` and vice versa. There is\n [theoretical evidence](http://www.robotics.stanford.edu/%7Eang/papers/icml04-l1l2.ps)\n that L1 regularization works better when many features are irrelevant.\n\nAnother benefit of L1 regularization is that it tends to set many model weights to exactly zero, which is helpful for identifying the most relevant features and training a compact model.\n\nWhat's next\n-----------\n\n- For an overview of BigQuery ML, see [Introduction to BigQuery ML](/bigquery/docs/bqml-introduction).\n- To get started using BigQuery ML, see [Create machine learning models in BigQuery ML](/bigquery/docs/create-machine-learning-model).\n- To learn more about working with models, see:\n - [Get model metadata](/bigquery/docs/getting-model-metadata)\n - [List models](/bigquery/docs/listing-models)\n - [Update model metadata](/bigquery/docs/updating-model-metadata)\n - [Manage models](/bigquery/docs/managing-models)"]]