|
1 | 1 | ---
|
2 |
| -title: What is automated ML / automl |
| 2 | +title: What is automated ML / AutoML |
3 | 3 | titleSuffix: Azure Machine Learning
|
4 | 4 | description: Learn how Azure Machine Learning can automatically pick an algorithm for you, and generate a model from it to save you time by using the parameters and criteria you provide to select the best algorithm for your model.
|
5 | 5 | services: machine-learning
|
@@ -98,8 +98,59 @@ Additional advanced preprocessing and featurization are also available, such as
|
98 | 98 |
|
99 | 99 | + Python SDK: Specifying `"feauturization": auto' / 'off' / FeaturizationConfig` for the [`AutoMLConfig` class](https://docs.microsoft.com/python/api/azureml-train-automl-client/azureml.train.automl.automlconfig.automlconfig?view=azure-ml-py).
|
100 | 100 |
|
| 101 | +## Prevent over-fitting |
| 102 | + |
| 103 | +Over-fitting in machine learning occurs when a model fits the training data too well, and as a result can't accurately predict on unseen test data. In other words, the model has simply memorized specific patterns and noise in the training data, but is not flexible enough to make predictions on real data. In the most egregious cases, an over-fitted model will assume that the feature value combinations seen during training will always result in the exact same output for the target. |
| 104 | + |
| 105 | +The best way to prevent over-fitting is to follow ML best-practices including: |
| 106 | + |
| 107 | +* Using more training data, and eliminating statistical bias |
| 108 | +* Preventing target leakage |
| 109 | +* Using less features |
| 110 | +* **Regularization and hyperparameter optimization** |
| 111 | +* **Model complexity limitations** |
| 112 | +* **Cross-validation** |
| 113 | + |
| 114 | +In the context of automated ML, the first three items above are **best-practices you implement**. The last three bolded items are **best-practices automated ML implements** by default to protect against over-fitting. In settings other than automated ML, all six best-practices are worth following to avoid over-fitting models. |
| 115 | + |
| 116 | +### Best practices you implement |
| 117 | + |
| 118 | +Using **more data** is the simplest and best possible way to prevent over-fitting, and as an added bonus typically increases accuracy. When you use more data, it becomes harder for the model to memorize exact patterns, and it is forced to reach solutions that are more flexible to accommodate more conditions. It's also important to recognize **statistical bias**, to ensure your training data doesn't include isolated patterns that won't exist in live-prediction data. This scenario can be difficult to solve, because there may not be over-fitting between your train and test sets, but there may be over-fitting present when compared to live test data. |
| 119 | + |
| 120 | +Target leakage is a similar issue, where you may not see over-fitting between train/test sets, but rather it appears at prediction-time. Target leakage occurs when your model "cheats" during training by having access to data that it shouldn't normally have at prediction-time. For example, if your problem is to predict on Monday what a commodity price will be on Friday, but one of your features accidentally included data from Thursdays, that would be data the model won't have at prediction-time since it cannot see into the future. Target leakage is an easy mistake to miss, but is often characterized by abnormally-high accuracy for your problem. If you are attempting to predict stock price and trained a model at 95% accuracy, there is very likely target leakage somewhere in your features. |
| 121 | + |
| 122 | +Removing features can also help with over-fitting by preventing the model from having too many fields to use to memorize specific patterns, thus causing it to be more flexible. It can be difficult to measure quantitatively, but if you can remove features and retain the same accuracy, you have likely made the model more flexible and have reduced the risk of over-fitting. |
| 123 | + |
| 124 | +### Best-practices automated ML implements |
| 125 | + |
| 126 | +Regularization is the process of minimizing a cost function to penalize complex and over-fitted models. There are different types of regularization functions, but in general they all penalize model coefficient size, variance, and complexity. Automated ML uses L1 (Lasso), L2 (Ridge), and ElasticNet (L1 and L2 simultaneously) in different combinations with different model hyperparameter settings that control over-fitting. In simple terms, automated ML will vary how much a model is regulated and choose the best result. |
| 127 | + |
| 128 | +Automated ML also implements explicit model complexity limitations to prevent over-fitting. In most cases this is specifically for decision tree or forest algorithms, where individual tree max-depth is limited, and the total number of trees used in forest or ensemble techniques are limited. |
| 129 | + |
| 130 | +Cross-validation (CV) is the process of taking many subsets of your full training data and training a model on each subset. The idea is that a model could get "lucky" and have great accuracy with one subset, but by using many subsets the model won't achieve this high accuracy every time. When doing CV, you provide a validation holdout dataset, specify your CV folds (number of subsets) and automated ML will train your model and tune hyperparameters to minimize error on your validation set. One CV fold could be over-fit, but by using many of them it reduces the probability that your final model is over-fit. The tradeoff is that CV does result in longer training times and thus greater cost, because instead of training a model once, you train it once for each *n* CV subsets. |
| 131 | + |
| 132 | +> [!NOTE] |
| 133 | +> Cross-validation is not enabled by default; it must be configured in automated ML settings. However, after |
| 134 | +> CV is configured and a validation data set has been provided, the process is automated for you. |
| 135 | +
|
| 136 | +### Identifying over-fitting |
| 137 | + |
| 138 | +Consider the following trained models and their corresponding train and test accuracies. |
| 139 | + |
| 140 | +| Model | Train accuracy | Test accuracy | |
| 141 | +|-------|----------------|---------------| |
| 142 | +| A | 99.9% | 95% | |
| 143 | +| B | 87% | 87% | |
| 144 | +| C | 99.9% | 45% | |
| 145 | + |
| 146 | +Considering model **A**, there is a common misconception that if test accuracy on unseen data is lower than training accuracy, the model is over-fitted. However, test accuracy should always be less than training accuracy, and the distinction for over-fit vs. appropriately fit comes down to *how much* less accurate. |
| 147 | + |
| 148 | +When comparing models **A** and **B**, model **A** is a better model because it has higher test accuracy, and although the test accuracy is slightly lower at 95%, it is not a significant difference that suggests over-fitting is present. You wouldn't choose model **B** simply because the train and test accuracies are closer together. |
| 149 | + |
| 150 | +Model **C** represents a clear case of over-fitting; the training accuracy is very high but the test accuracy isn't anywhere near as high. This distinction is somewhat subjective, but comes from knowledge of your problem and data, and what magnitudes of error are acceptable. |
101 | 151 |
|
102 | 152 | ## Time-series forecasting
|
| 153 | + |
103 | 154 | Building forecasts is an integral part of any business, whether it’s revenue, inventory, sales, or customer demand. You can use automated ML to combine techniques and approaches and get a recommended, high-quality time-series forecast.
|
104 | 155 |
|
105 | 156 | An automated time-series experiment is treated as a multivariate regression problem. Past time-series values are “pivoted” to become additional dimensions for the regressor together with other predictors. This approach, unlike classical time series methods, has an advantage of naturally incorporating multiple contextual variables and their relationship to one another during training. Automated ML learns a single, but often internally branched model for all items in the dataset and prediction horizons. More data is thus available to estimate model parameters and generalization to unseen series becomes possible.
|
|
0 commit comments