# fitcauto

Automatically select classification model with optimized hyperparameters

## Syntax

``Mdl = fitcauto(Tbl,ResponseVarName)``
``Mdl = fitcauto(Tbl,formula)``
``Mdl = fitcauto(Tbl,Y)``
``Mdl = fitcauto(X,Y)``
``Mdl = fitcauto(___,Name,Value)``
``[Mdl,OptimizationResults] = fitcauto(___)``

## Description

Given predictor and response data, `fitcauto` automatically tries a selection of classification model types with different hyperparameter values. By default, the function uses Bayesian optimization to select models and their hyperparameter values, and computes the cross-validation classification error for each model. After the optimization is complete, `fitcauto` returns the model, trained on the entire data set, that is expected to best classify new data. You can use the `predict` and `loss` object functions of the returned model to classify new data and compute the test set classification error, respectively.

Use `fitcauto` when you are uncertain which classifier types best suit your data. For information on alternative methods for tuning hyperparameters of classification models, see Alternative Functionality.

If your data contains over 10,000 observations, consider using an asynchronous successive halving algorithm (ASHA) instead of Bayesian optimization when you run `fitcauto`. ASHA optimization often finds good solutions faster than Bayesian optimization for data sets with many observations.

example

````Mdl = fitcauto(Tbl,ResponseVarName)` returns a classification model `Mdl` with tuned hyperparameters. The table `Tbl` contains the predictor variables and the response variable, where `ResponseVarName` is the name of the response variable.```
````Mdl = fitcauto(Tbl,formula)` uses `formula` to specify the response variable and the predictor variables to consider among the variables in `Tbl`.```
````Mdl = fitcauto(Tbl,Y)` uses the predictor variables in table `Tbl` and the class labels in vector `Y`.```

example

````Mdl = fitcauto(X,Y)` uses the predictor variables in matrix `X` and the class labels in vector `Y`.```

example

````Mdl = fitcauto(___,Name,Value)` specifies options using one or more name-value arguments in addition to any of the input argument combinations in previous syntaxes. For example, use the `HyperparameterOptimizationOptions` name-value argument to specify whether to use Bayesian optimization (default) or an asynchronous successive halving algorithm (ASHA). To use ASHA optimization, specify `"HyperparameterOptimizationOptions",struct("Optimizer","asha")`. You can include additional fields in the structure to control other aspects of the optimization.```

example

````[Mdl,OptimizationResults] = fitcauto(___)` also returns `OptimizationResults`, which contains the results of the model selection and hyperparameter tuning process. This output is a `BayesianOptimization` object when you use Bayesian optimization, and a table when you use ASHA optimization.```

## Examples

collapse all

Use `fitcauto` to automatically select a classification model with optimized hyperparameters, given predictor and response data stored in a table.

Load the `carbig` data set, which contains measurements of cars made in the 1970s and early 1980s.

`load carbig`

Categorize the cars based on whether they were made in the USA.

```Origin = categorical(cellstr(Origin)); Origin = mergecats(Origin,["France","Japan","Germany", ... "Sweden","Italy","England"],"NotUSA");```

Create a table containing the predictor variables `Acceleration`, `Displacement`, and so on, as well as the response variable `Origin`.

```cars = table(Acceleration,Displacement,Horsepower, ... Model_Year,MPG,Weight,Origin);```

Partition Data

Partition the data into training and test sets. Use approximately 80% of the observations for the model selection and hyperparameter tuning process, and 20% of the observations to test the performance of the final model returned by `fitcauto`. Use `cvpartition` to partition the data.

```rng("default") % For reproducibility of the data partition c = cvpartition(Origin,"Holdout",0.2); trainingIdx = training(c); % Training set indices carsTrain = cars(trainingIdx,:); testIdx = test(c); % Test set indices carsTest = cars(testIdx,:);```

Run `fitcauto`

Pass the training data to `fitcauto`. By default, `fitcauto` determines appropriate model types to try, uses Bayesian optimization to find good hyperparameter values, and returns a trained model `Mdl` with the best expected performance. Additionally, `fitcauto` provides a plot of the optimization and an iterative display of the optimization results. For more information on how to interpret these results, see Verbose Display.

Expect this process to take some time. To speed up the optimization process, consider specifying to run the optimization in parallel, if you have a Parallel Computing Toolbox™ license. To do so, pass `"HyperparameterOptimizationOptions",struct("UseParallel",true)` to `fitcauto` as a name-value argument.

`Mdl = fitcauto(carsTrain,"Origin");`
```Warning: It is recommended that you first standardize all numeric predictors when optimizing the Naive Bayes 'Width' parameter. Ignore this warning if you have done that. ```
```Learner types to explore: ensemble, knn, nb, svm, tree Total iterations (MaxObjectiveEvaluations): 150 Total time (MaxTime): Inf |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 1 | Best | 0.14154 | 15.261 | 0.14154 | 0.14154 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 201 | | | | | | | | | MinLeafSize: 7 | | 2 | Accept | 0.18269 | 0.78311 | 0.14154 | 0.14154 | knn | NumNeighbors: 3 | | 3 | Accept | 0.23397 | 0.12849 | 0.14154 | 0.14154 | knn | NumNeighbors: 91 | | 4 | Best | 0.092308 | 8.1968 | 0.092308 | 0.11151 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 274 | | | | | | | | | MinLeafSize: 15 | | 5 | Accept | 0.20833 | 0.122 | 0.092308 | 0.11151 | knn | NumNeighbors: 4 | | 6 | Accept | 0.22115 | 0.074924 | 0.092308 | 0.11151 | knn | NumNeighbors: 28 | | 7 | Accept | 0.16923 | 0.22742 | 0.092308 | 0.11151 | tree | MinLeafSize: 105 | | 8 | Accept | 0.37179 | 0.59424 | 0.092308 | 0.11151 | svm | BoxConstraint: 0.022186 | | | | | | | | | KernelScale: 0.085527 | | 9 | Accept | 0.37179 | 0.095134 | 0.092308 | 0.11151 | svm | BoxConstraint: 0.045899 | | | | | | | | | KernelScale: 0.0024758 | | 10 | Accept | 0.24615 | 0.92999 | 0.092308 | 0.11151 | nb | DistributionNames: kernel | | | | | | | | | Width: 1.1327 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 11 | Accept | 0.16923 | 0.072747 | 0.092308 | 0.11151 | tree | MinLeafSize: 78 | | 12 | Accept | 0.26923 | 0.098838 | 0.092308 | 0.11151 | svm | BoxConstraint: 11.063 | | | | | | | | | KernelScale: 15.114 | | 13 | Accept | 0.12923 | 0.09922 | 0.092308 | 0.11151 | tree | MinLeafSize: 3 | | 14 | Accept | 0.21154 | 0.077411 | 0.092308 | 0.11151 | knn | NumNeighbors: 2 | | 15 | Accept | 0.14154 | 0.070449 | 0.092308 | 0.11151 | tree | MinLeafSize: 1 | | 16 | Accept | 0.14769 | 0.07596 | 0.092308 | 0.11151 | tree | MinLeafSize: 2 | | 17 | Accept | 0.14154 | 8.0622 | 0.092308 | 0.12513 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 208 | | | | | | | | | MinLeafSize: 10 | | 18 | Accept | 0.37179 | 0.092223 | 0.092308 | 0.12513 | svm | BoxConstraint: 116.46 | | | | | | | | | KernelScale: 0.52908 | | 19 | Accept | 0.22769 | 0.14447 | 0.092308 | 0.12513 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 20 | Accept | 0.22115 | 0.063369 | 0.092308 | 0.12513 | knn | NumNeighbors: 8 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 21 | Accept | 0.37179 | 0.11033 | 0.092308 | 0.12513 | svm | BoxConstraint: 45.341 | | | | | | | | | KernelScale: 0.76949 | | 22 | Accept | 0.12923 | 0.069586 | 0.092308 | 0.12513 | tree | MinLeafSize: 3 | | 23 | Accept | 0.10154 | 0.063197 | 0.092308 | 0.12513 | tree | MinLeafSize: 5 | | 24 | Accept | 0.22769 | 0.18312 | 0.092308 | 0.12513 | nb | DistributionNames: kernel | | | | | | | | | Width: 0.42571 | | 25 | Accept | 0.11385 | 0.062328 | 0.092308 | 0.12513 | tree | MinLeafSize: 11 | | 26 | Accept | 0.13782 | 0.069932 | 0.092308 | 0.12513 | svm | BoxConstraint: 9.7286 | | | | | | | | | KernelScale: 293.41 | | 27 | Accept | 0.22769 | 0.053256 | 0.092308 | 0.12513 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 28 | Accept | 0.21795 | 0.062882 | 0.092308 | 0.12513 | knn | NumNeighbors: 42 | | 29 | Accept | 0.24308 | 0.20538 | 0.092308 | 0.12513 | nb | DistributionNames: kernel | | | | | | | | | Width: 4.4662 | | 30 | Accept | 0.37231 | 6.3057 | 0.092308 | 0.1289 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 267 | | | | | | | | | MinLeafSize: 131 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 31 | Accept | 0.24308 | 0.18689 | 0.092308 | 0.1289 | nb | DistributionNames: kernel | | | | | | | | | Width: 0.66296 | | 32 | Accept | 0.22115 | 0.070866 | 0.092308 | 0.1289 | knn | NumNeighbors: 28 | | 33 | Accept | 0.13846 | 0.080818 | 0.092308 | 0.12465 | tree | MinLeafSize: 25 | | 34 | Accept | 0.21474 | 0.061727 | 0.092308 | 0.12465 | knn | NumNeighbors: 14 | | 35 | Best | 0.089231 | 5.4041 | 0.089231 | 0.12465 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 215 | | | | | | | | | MinLeafSize: 13 | | 36 | Accept | 0.14154 | 9.5 | 0.089231 | 0.12465 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 254 | | | | | | | | | MinLeafSize: 31 | | 37 | Accept | 0.22769 | 0.058919 | 0.089231 | 0.12465 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 38 | Accept | 0.37179 | 0.07729 | 0.089231 | 0.12465 | svm | BoxConstraint: 0.0073633 | | | | | | | | | KernelScale: 774.33 | | 39 | Accept | 0.16923 | 0.066123 | 0.089231 | 0.12552 | tree | MinLeafSize: 82 | | 40 | Accept | 0.20833 | 0.063808 | 0.089231 | 0.12552 | knn | NumNeighbors: 4 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 41 | Accept | 0.37231 | 6.3806 | 0.089231 | 0.12552 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 274 | | | | | | | | | MinLeafSize: 150 | | 42 | Accept | 0.22462 | 0.1782 | 0.089231 | 0.12552 | nb | DistributionNames: kernel | | | | | | | | | Width: 121.64 | | 43 | Accept | 0.20308 | 8.3787 | 0.089231 | 0.12552 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 229 | | | | | | | | | MinLeafSize: 117 | | 44 | Accept | 0.16923 | 0.060332 | 0.089231 | 0.12291 | tree | MinLeafSize: 84 | | 45 | Accept | 0.22769 | 0.054836 | 0.089231 | 0.12291 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 46 | Accept | 0.22769 | 0.051984 | 0.089231 | 0.12291 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 47 | Accept | 0.092308 | 5.064 | 0.089231 | 0.11792 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 212 | | | | | | | | | MinLeafSize: 49 | | 48 | Accept | 0.14769 | 10.667 | 0.089231 | 0.11634 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 288 | | | | | | | | | MinLeafSize: 25 | | 49 | Accept | 0.23077 | 0.17743 | 0.089231 | 0.11634 | nb | DistributionNames: kernel | | | | | | | | | Width: 73.249 | | 50 | Accept | 0.37179 | 0.12425 | 0.089231 | 0.11634 | svm | BoxConstraint: 0.0036501 | | | | | | | | | KernelScale: 1.0504 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 51 | Accept | 0.21474 | 0.083155 | 0.089231 | 0.11634 | svm | BoxConstraint: 64.859 | | | | | | | | | KernelScale: 23.779 | | 52 | Accept | 0.37179 | 0.082077 | 0.089231 | 0.11634 | svm | BoxConstraint: 0.16622 | | | | | | | | | KernelScale: 4.4901 | | 53 | Accept | 0.25846 | 0.21018 | 0.089231 | 0.11634 | nb | DistributionNames: kernel | | | | | | | | | Width: 0.079498 | | 54 | Accept | 0.21154 | 0.063584 | 0.089231 | 0.11634 | knn | NumNeighbors: 2 | | 55 | Accept | 0.13846 | 9.0089 | 0.089231 | 0.10262 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 234 | | | | | | | | | MinLeafSize: 8 | | 56 | Accept | 0.36538 | 0.086614 | 0.089231 | 0.10262 | svm | BoxConstraint: 271.6 | | | | | | | | | KernelScale: 2.743 | | 57 | Accept | 0.18154 | 5.8294 | 0.089231 | 0.10947 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 248 | | | | | | | | | MinLeafSize: 117 | | 58 | Accept | 0.37179 | 0.087804 | 0.089231 | 0.10947 | svm | BoxConstraint: 7.5785 | | | | | | | | | KernelScale: 0.0066815 | | 59 | Accept | 0.37179 | 0.083397 | 0.089231 | 0.10947 | svm | BoxConstraint: 0.0017765 | | | | | | | | | KernelScale: 0.86786 | | 60 | Accept | 0.37179 | 0.081802 | 0.089231 | 0.10947 | svm | BoxConstraint: 0.011465 | | | | | | | | | KernelScale: 0.02747 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 61 | Accept | 0.11692 | 0.070203 | 0.089231 | 0.10947 | tree | MinLeafSize: 12 | | 62 | Accept | 0.29167 | 0.087616 | 0.089231 | 0.10947 | svm | BoxConstraint: 11.939 | | | | | | | | | KernelScale: 11.002 | | 63 | Accept | 0.21795 | 0.067296 | 0.089231 | 0.10947 | knn | NumNeighbors: 6 | | 64 | Accept | 0.18269 | 0.062677 | 0.089231 | 0.10947 | knn | NumNeighbors: 3 | | 65 | Accept | 0.12923 | 0.062417 | 0.089231 | 0.10947 | tree | MinLeafSize: 3 | | 66 | Accept | 0.16923 | 0.066062 | 0.089231 | 0.10947 | tree | MinLeafSize: 56 | | 67 | Accept | 0.1891 | 0.072064 | 0.089231 | 0.10947 | knn | NumNeighbors: 1 | | 68 | Accept | 0.13231 | 10.405 | 0.089231 | 0.10927 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 270 | | | | | | | | | MinLeafSize: 4 | | 69 | Accept | 0.22769 | 0.058514 | 0.089231 | 0.10927 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 70 | Accept | 0.37231 | 0.16623 | 0.089231 | 0.10927 | nb | DistributionNames: kernel | | | | | | | | | Width: 1629.5 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 71 | Accept | 0.16923 | 0.059987 | 0.089231 | 0.10927 | tree | MinLeafSize: 61 | | 72 | Accept | 0.22769 | 0.051395 | 0.089231 | 0.10927 | nb | DistributionNames: normal | | | | | | | | | Width: NaN | | 73 | Accept | 0.12308 | 5.0871 | 0.089231 | 0.10454 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 217 | | | | | | | | | MinLeafSize: 70 | | 74 | Accept | 0.13231 | 10.737 | 0.089231 | 0.10577 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 257 | | | | | | | | | MinLeafSize: 2 | | 75 | Accept | 0.21474 | 0.080252 | 0.089231 | 0.10577 | knn | NumNeighbors: 49 | | 76 | Accept | 0.10154 | 7.3068 | 0.089231 | 0.099465 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 285 | | | | | | | | | MinLeafSize: 2 | | 77 | Accept | 0.12923 | 5.5706 | 0.089231 | 0.10383 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 214 | | | | | | | | | MinLeafSize: 72 | | 78 | Accept | 0.12308 | 5.0042 | 0.089231 | 0.099898 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 213 | | | | | | | | | MinLeafSize: 73 | | 79 | Accept | 0.13538 | 6.7572 | 0.089231 | 0.1013 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 291 | | | | | | | | | MinLeafSize: 92 | | 80 | Accept | 0.12 | 5.1409 | 0.089231 | 0.099163 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 222 | | | | | | | | | MinLeafSize: 28 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 81 | Accept | 0.14462 | 4.897 | 0.089231 | 0.10034 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 210 | | | | | | | | | MinLeafSize: 102 | | 82 | Best | 0.086154 | 5.009 | 0.086154 | 0.094283 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 208 | | | | | | | | | MinLeafSize: 15 | | 83 | Accept | 0.089231 | 5.6605 | 0.086154 | 0.092125 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 237 | | | | | | | | | MinLeafSize: 15 | | 84 | Accept | 0.092308 | 5.9891 | 0.086154 | 0.092405 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 256 | | | | | | | | | MinLeafSize: 20 | | 85 | Accept | 0.098462 | 4.9373 | 0.086154 | 0.09151 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 202 | | | | | | | | | MinLeafSize: 16 | | 86 | Accept | 0.092308 | 6.354 | 0.086154 | 0.091482 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 262 | | | | | | | | | MinLeafSize: 13 | | 87 | Accept | 0.13846 | 5.1929 | 0.086154 | 0.090767 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 224 | | | | | | | | | MinLeafSize: 98 | | 88 | Accept | 0.10769 | 5.2709 | 0.086154 | 0.093092 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 216 | | | | | | | | | MinLeafSize: 7 | | 89 | Accept | 0.11385 | 6.2613 | 0.086154 | 0.092237 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 263 | | | | | | | | | MinLeafSize: 23 | | 90 | Accept | 0.089231 | 5.1591 | 0.086154 | 0.090261 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 212 | | | | | | | | | MinLeafSize: 15 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 91 | Accept | 0.098462 | 5.5561 | 0.086154 | 0.091164 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 231 | | | | | | | | | MinLeafSize: 14 | | 92 | Accept | 0.092308 | 7.0841 | 0.086154 | 0.090418 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 293 | | | | | | | | | MinLeafSize: 15 | | 93 | Accept | 0.10462 | 5.4911 | 0.086154 | 0.090933 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 200 | | | | | | | | | MinLeafSize: 10 | | 94 | Accept | 0.095385 | 6.2488 | 0.086154 | 0.089667 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 238 | | | | | | | | | MinLeafSize: 20 | | 95 | Accept | 0.14154 | 5.9513 | 0.086154 | 0.090672 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 211 | | | | | | | | | MinLeafSize: 101 | | 96 | Accept | 0.086154 | 7.211 | 0.086154 | 0.089308 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 207 | | | | | | | | | MinLeafSize: 15 | | 97 | Accept | 0.095385 | 7.0247 | 0.086154 | 0.088701 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 220 | | | | | | | | | MinLeafSize: 15 | | 98 | Accept | 0.092308 | 5.6392 | 0.086154 | 0.088919 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 209 | | | | | | | | | MinLeafSize: 20 | | 99 | Accept | 0.092308 | 5.3506 | 0.086154 | 0.088952 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 207 | | | | | | | | | MinLeafSize: 14 | | 100 | Accept | 0.089231 | 5.0422 | 0.086154 | 0.089122 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 202 | | | | | | | | | MinLeafSize: 15 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 101 | Accept | 0.11077 | 6.5738 | 0.086154 | 0.088935 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 262 | | | | | | | | | MinLeafSize: 23 | | 102 | Accept | 0.092308 | 6.6426 | 0.086154 | 0.088627 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 272 | | | | | | | | | MinLeafSize: 15 | | 103 | Accept | 0.14462 | 5.156 | 0.086154 | 0.088746 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 218 | | | | | | | | | MinLeafSize: 108 | | 104 | Accept | 0.092308 | 7.2137 | 0.086154 | 0.088254 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 295 | | | | | | | | | MinLeafSize: 15 | | 105 | Accept | 0.095385 | 5.2094 | 0.086154 | 0.088642 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 209 | | | | | | | | | MinLeafSize: 11 | | 106 | Accept | 0.086154 | 5.167 | 0.086154 | 0.088732 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 15 | | 107 | Accept | 0.086154 | 5.0251 | 0.086154 | 0.087649 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 15 | | 108 | Accept | 0.092308 | 4.8932 | 0.086154 | 0.087563 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 201 | | | | | | | | | MinLeafSize: 14 | | 109 | Accept | 0.098462 | 7.0345 | 0.086154 | 0.087822 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 288 | | | | | | | | | MinLeafSize: 20 | | 110 | Accept | 0.10769 | 5.0962 | 0.086154 | 0.087788 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 10 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 111 | Accept | 0.092308 | 5.0295 | 0.086154 | 0.087969 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 206 | | | | | | | | | MinLeafSize: 20 | | 112 | Accept | 0.14769 | 5.0148 | 0.086154 | 0.088051 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 214 | | | | | | | | | MinLeafSize: 110 | | 113 | Accept | 0.086154 | 4.9943 | 0.086154 | 0.087118 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 201 | | | | | | | | | MinLeafSize: 15 | | 114 | Accept | 0.14154 | 6.1042 | 0.086154 | 0.087477 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 238 | | | | | | | | | MinLeafSize: 110 | | 115 | Accept | 0.098462 | 5.589 | 0.086154 | 0.087375 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 217 | | | | | | | | | MinLeafSize: 15 | | 116 | Accept | 0.086154 | 5.0709 | 0.086154 | 0.087064 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 15 | | 117 | Accept | 0.086154 | 5.0476 | 0.086154 | 0.086927 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 203 | | | | | | | | | MinLeafSize: 15 | | 118 | Accept | 0.095385 | 5.1616 | 0.086154 | 0.086424 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 206 | | | | | | | | | MinLeafSize: 11 | | 119 | Accept | 0.17231 | 7.5631 | 0.086154 | 0.086811 | ensemble | Method: Bag | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 104 | | 120 | Accept | 0.11385 | 6.1048 | 0.086154 | 0.086479 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 256 | | | | | | | | | MinLeafSize: 26 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 121 | Accept | 0.10154 | 4.9144 | 0.086154 | 0.086731 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 16 | | 122 | Accept | 0.11385 | 6.6916 | 0.086154 | 0.086764 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 290 | | | | | | | | | MinLeafSize: 26 | | 123 | Accept | 0.17846 | 4.9356 | 0.086154 | 0.086982 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 213 | | | | | | | | | MinLeafSize: 121 | | 124 | Accept | 0.18154 | 6.7496 | 0.086154 | 0.086624 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 295 | | | | | | | | | MinLeafSize: 124 | | 125 | Accept | 0.092308 | 4.856 | 0.086154 | 0.086795 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 207 | | | | | | | | | MinLeafSize: 46 | | 126 | Accept | 0.086154 | 4.8119 | 0.086154 | 0.086787 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 203 | | | | | | | | | MinLeafSize: 15 | | 127 | Accept | 0.13231 | 4.7345 | 0.086154 | 0.086511 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 58 | | 128 | Accept | 0.15385 | 7.0641 | 0.086154 | 0.086611 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 299 | | | | | | | | | MinLeafSize: 112 | | 129 | Accept | 0.086154 | 5.0542 | 0.086154 | 0.08658 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 207 | | | | | | | | | MinLeafSize: 15 | | 130 | Accept | 0.2 | 4.7512 | 0.086154 | 0.086476 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 201 | | | | | | | | | MinLeafSize: 126 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 131 | Accept | 0.13231 | 5.0661 | 0.086154 | 0.086354 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 209 | | | | | | | | | MinLeafSize: 53 | | 132 | Accept | 0.089231 | 5.0199 | 0.086154 | 0.086357 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 209 | | | | | | | | | MinLeafSize: 15 | | 133 | Accept | 0.098462 | 4.7946 | 0.086154 | 0.086579 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 204 | | | | | | | | | MinLeafSize: 48 | | 134 | Accept | 0.092308 | 4.8843 | 0.086154 | 0.086467 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 209 | | | | | | | | | MinLeafSize: 50 | | 135 | Best | 0.083077 | 4.9469 | 0.083077 | 0.085907 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 205 | | | | | | | | | MinLeafSize: 15 | | 136 | Accept | 0.095385 | 4.954 | 0.083077 | 0.085641 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 210 | | | | | | | | | MinLeafSize: 41 | | 137 | Accept | 0.098462 | 4.9278 | 0.083077 | 0.085638 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 210 | | | | | | | | | MinLeafSize: 51 | | 138 | Accept | 0.10154 | 4.9427 | 0.083077 | 0.085538 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 209 | | | | | | | | | MinLeafSize: 51 | | 139 | Accept | 0.089231 | 5.0365 | 0.083077 | 0.085955 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 215 | | | | | | | | | MinLeafSize: 45 | | 140 | Accept | 0.083077 | 4.8738 | 0.083077 | 0.085392 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 205 | | | | | | | | | MinLeafSize: 15 | |=================================================================================================================================| | Iter | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | result | loss | & validation (sec)| validation loss | validation loss | | | |=================================================================================================================================| | 141 | Accept | 0.10769 | 5.0619 | 0.083077 | 0.085017 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 213 | | | | | | | | | MinLeafSize: 23 | | 142 | Accept | 0.089231 | 5.1143 | 0.083077 | 0.085054 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 215 | | | | | | | | | MinLeafSize: 49 | | 143 | Accept | 0.089231 | 5.5325 | 0.083077 | 0.085025 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 237 | | | | | | | | | MinLeafSize: 49 | | 144 | Accept | 0.089231 | 5.4298 | 0.083077 | 0.084846 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 234 | | | | | | | | | MinLeafSize: 49 | | 145 | Accept | 0.092308 | 5.4706 | 0.083077 | 0.084781 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 224 | | | | | | | | | MinLeafSize: 43 | | 146 | Accept | 0.098462 | 6.0056 | 0.083077 | 0.084933 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 248 | | | | | | | | | MinLeafSize: 51 | | 147 | Accept | 0.086154 | 6.3296 | 0.083077 | 0.084906 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 263 | | | | | | | | | MinLeafSize: 49 | | 148 | Accept | 0.083077 | 6.4813 | 0.083077 | 0.084823 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 273 | | | | | | | | | MinLeafSize: 49 | | 149 | Accept | 0.086154 | 7.0564 | 0.083077 | 0.085268 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 298 | | | | | | | | | MinLeafSize: 49 | | 150 | Accept | 0.095385 | 6.4287 | 0.083077 | 0.085022 | ensemble | Method: LogitBoost | | | | | | | | | NumLearningCycles: 268 | | | | | | | | | MinLeafSize: 37 | ```

```__________________________________________________________ Optimization completed. Total iterations: 150 Total elapsed time: 698.3513 seconds Total time for training and validation: 553.6354 seconds Best observed learner is an ensemble model with: Method: LogitBoost NumLearningCycles: 205 MinLeafSize: 15 Observed validation loss: 0.083077 Time for training and validation: 4.9469 seconds Best estimated learner (returned model) is an ensemble model with: Method: LogitBoost NumLearningCycles: 205 MinLeafSize: 15 Estimated validation loss: 0.085022 Estimated time for training and validation: 4.9757 seconds Documentation for fitcauto display ```

The final model returned by `fitcauto` corresponds to the best estimated learner. Before returning the model, the function retrains it using the entire training data (`carsTrain`), the listed `Learner` (or model) type, and the displayed hyperparameter values.

Evaluate Test Set Performance

Evaluate the performance of the model on the test set.

`testAccuracy = 1 - loss(Mdl,carsTest,"Origin")`
```testAccuracy = 0.9263 ```
`confusionchart(carsTest.Origin,predict(Mdl,carsTest))`

Use `fitcauto` to automatically select a classification model with optimized hyperparameters, given predictor and response data stored in separate variables.

Load the `humanactivity` data set. This data set contains 24,075 observations of five physical human activities: Sitting (1), Standing (2), Walking (3), Running (4), and Dancing (5). Each observation has 60 features extracted from acceleration data measured by smartphone accelerometer sensors. The variable `feat` contains the predictor data matrix of the 60 features for the 24,075 observations, and the response variable `actid` contains the activity IDs for the observations as integers.

`load humanactivity`

Partition Data

Partition the data into training and test sets. Use 90% of the observations to select a model, and 10% of the observations to validate the final model returned by `fitcauto`. Use `cvpartition` to reserve 10% of the observations for testing.

```rng("default") % For reproducibility of the partition c = cvpartition(actid,"Holdout",0.10); trainingIndices = training(c); % Indices for the training set XTrain = feat(trainingIndices,:); YTrain = actid(trainingIndices); testIndices = test(c); % Indices for the test set XTest = feat(testIndices,:); YTest = actid(testIndices);```

Run `fitcauto`

Pass the training data to `fitcauto`. Because the training data `XTrain` has more than 10,000 observations, use ASHA optimization rather than Bayesian optimization. The `fitcauto` function randomly selects appropriate model (or learner) types with different hyperparameter values, trains the models on a small subset of the training data, promotes the models that perform well, and retrains the promoted models on progressively larger sets of training data. The function returns the model with the best cross-validation performance, retrained on all the training data, and a table that contains the details of the optimization. Specify to run the optimization in parallel (requires Parallel Computing Toolbox™).

By default, `fitcauto` provides a plot of the optimization and an iterative display of the optimization results. For more information on how to interpret these results, see Verbose Display.

```options = struct("Optimizer","asha","UseParallel",true); [Mdl,OptimizationResults] = fitcauto(XTrain,YTrain,"HyperparameterOptimizationOptions",options);```
```Warning: It is recommended that you first standardize all numeric predictors when optimizing the Naive Bayes 'Width' parameter. Ignore this warning if you have done that. ```
```Starting parallel pool (parpool) using the 'local' profile ... Connected to the parallel pool (number of workers: 6). Copying objective function to workers... Done copying objective function to workers. Learner types to explore: ensemble, knn, nb, svm, tree Total iterations (MaxObjectiveEvaluations): 510 Total time (MaxTime): Inf |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 1 | 6 | Best | 0.74165 | 7.0787 | 0.74165 | 271 | tree | MinLeafSize: 723 | | 2 | 2 | Accept | 0.1169 | 9.5275 | 0.043705 | 271 | knn | NumNeighbors: 42 | | 3 | 2 | Accept | 0.74165 | 11.543 | 0.043705 | 271 | knn | NumNeighbors: 1726 | | 4 | 2 | Accept | 0.084872 | 9.3569 | 0.043705 | 271 | knn | NumNeighbors: 27 | | 5 | 2 | Best | 0.043705 | 7.027 | 0.043705 | 271 | tree | MinLeafSize: 7 | | 6 | 2 | Accept | 0.060642 | 7.0193 | 0.043705 | 271 | tree | MinLeafSize: 11 | | 7 | 4 | Accept | 0.044443 | 1.4788 | 0.043705 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 8 | 5 | Accept | 0.058243 | 0.79831 | 0.028983 | 271 | tree | MinLeafSize: 25 | | 9 | 5 | Best | 0.028983 | 2.1507 | 0.028983 | 1084 | tree | MinLeafSize: 7 | | 10 | 6 | Accept | 0.049566 | 1.0799 | 0.028983 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 11 | 6 | Accept | 0.74165 | 5.5337 | 0.028983 | 271 | knn | NumNeighbors: 3072 | | 12 | 6 | Accept | 0.74155 | 5.2384 | 0.028983 | 271 | knn | NumNeighbors: 178 | | 13 | 6 | Accept | 0.53974 | 5.9615 | 0.028983 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.44923 | | | | | | | | | | KernelScale: 517.98 | | 14 | 6 | Accept | 0.74165 | 5.9452 | 0.028983 | 271 | knn | NumNeighbors: 294 | | 15 | 6 | Accept | 0.038259 | 1.6449 | 0.028983 | 1084 | tree | MinLeafSize: 25 | | 16 | 6 | Accept | 0.11579 | 17.724 | 0.028983 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 218 | | | | | | | | | | MinLeafSize: 60 | | | | | | | | | | MaxNumSplits: 12 | | 17 | 5 | Accept | 0.73966 | 12.951 | 0.028983 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 585.98 | | | | | | | | | | KernelScale: 0.021825 | | 18 | 5 | Accept | 0.68617 | 12.504 | 0.028983 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.0058216 | | | | | | | | | | KernelScale: 0.45032 | | 19 | 6 | Accept | 0.74165 | 11.499 | 0.028983 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.0634 | | | | | | | | | | KernelScale: 0.0035173 | | 20 | 6 | Accept | 0.035582 | 1.612 | 0.028983 | 1084 | tree | MinLeafSize: 11 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 21 | 6 | Accept | 0.74008 | 3.8698 | 0.028983 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.040932 | | | | | | | | | | KernelScale: 949.09 | | 22 | 6 | Best | 0.02326 | 1.302 | 0.02326 | 4334 | tree | MinLeafSize: 7 | | 23 | 6 | Accept | 0.7057 | 12.734 | 0.02326 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 53.678 | | | | | | | | | | KernelScale: 0.3797 | | 24 | 6 | Accept | 0.055289 | 2.0309 | 0.02326 | 271 | knn | NumNeighbors: 5 | | 25 | 6 | Accept | 0.051966 | 2.2552 | 0.02326 | 271 | knn | NumNeighbors: 7 | | 26 | 6 | Accept | 0.74165 | 6.4874 | 0.02326 | 271 | knn | NumNeighbors: 1240 | | 27 | 6 | Accept | 0.73962 | 12.459 | 0.02326 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.099738 | | | | | | | | | | KernelScale: 0.0018954 | | 28 | 6 | Accept | 0.1439 | 3.0955 | 0.02326 | 271 | knn | NumNeighbors: 44 | | 29 | 6 | Accept | 0.045874 | 2.1894 | 0.02326 | 271 | knn | NumNeighbors: 2 | | 30 | 6 | Accept | 0.035306 | 15.731 | 0.02326 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 213 | | | | | | | | | | MinLeafSize: 12 | | | | | | | | | | MaxNumSplits: 65 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 31 | 6 | Accept | 0.043197 | 7.5214 | 0.02326 | 1084 | knn | NumNeighbors: 7 | | 32 | 6 | Accept | 0.055381 | 1.9818 | 0.02326 | 271 | knn | NumNeighbors: 3 | | 33 | 6 | Accept | 0.054181 | 0.57186 | 0.02326 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 34 | 6 | Accept | 0.74165 | 0.21834 | 0.02326 | 271 | tree | MinLeafSize: 369 | | 35 | 6 | Accept | 0.74165 | 5.8009 | 0.02326 | 271 | knn | NumNeighbors: 1193 | | 36 | 6 | Accept | 0.033921 | 6.9268 | 0.02326 | 1084 | knn | NumNeighbors: 2 | | 37 | 6 | Accept | 0.057089 | 1.2849 | 0.02326 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 38 | 6 | Accept | 0.35559 | 2.2316 | 0.02326 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 3.2454 | | | | | | | | | | KernelScale: 500.94 | | 39 | 6 | Accept | 0.047536 | 2.6934 | 0.02326 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 432.63 | | | | | | | | | | KernelScale: 373.97 | | 40 | 6 | Accept | 0.032075 | 2.0195 | 0.02326 | 1084 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 432.63 | | | | | | | | | | KernelScale: 373.97 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 41 | 6 | Accept | 0.10859 | 2.0835 | 0.02326 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.0052814 | | | | | | | | | | KernelScale: 546.04 | | 42 | 6 | Accept | 0.74165 | 7.2993 | 0.02326 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.0068861 | | | | | | | | | | KernelScale: 1.9477 | | 43 | 6 | Accept | 0.74165 | 5.6881 | 0.02326 | 271 | knn | NumNeighbors: 524 | | 44 | 6 | Accept | 0.051089 | 2.0414 | 0.02326 | 271 | knn | NumNeighbors: 3 | | 45 | 6 | Accept | 0.7398 | 10.815 | 0.02326 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 5.009 | | | | | | | | | | KernelScale: 0.0070102 | | 46 | 6 | Accept | 0.03069 | 25.357 | 0.02326 | 1084 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 213 | | | | | | | | | | MinLeafSize: 12 | | | | | | | | | | MaxNumSplits: 65 | | 47 | 6 | Accept | 0.036552 | 7.16 | 0.02326 | 1084 | knn | NumNeighbors: 3 | | 48 | 6 | Accept | 0.047166 | 1.8295 | 0.02326 | 271 | knn | NumNeighbors: 2 | | 49 | 6 | Accept | 0.049105 | 0.49734 | 0.02326 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 50 | 6 | Accept | 0.73934 | 10.403 | 0.02326 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 198.87 | | | | | | | | | | KernelScale: 0.085112 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 51 | 6 | Accept | 0.7314 | 74.726 | 0.02326 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 9.8268e-06 | | 52 | 6 | Accept | 0.74165 | 10.108 | 0.02326 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.24903 | | | | | | | | | | KernelScale: 0.043685 | | 53 | 6 | Accept | 0.036413 | 6.719 | 0.02326 | 1084 | knn | NumNeighbors: 2 | | 54 | 6 | Accept | 0.060781 | 2.3593 | 0.02326 | 271 | knn | NumNeighbors: 13 | | 55 | 6 | Accept | 0.74063 | 11.248 | 0.02326 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.51791 | | | | | | | | | | KernelScale: 0.32403 | | 56 | 6 | Accept | 0.73029 | 62.941 | 0.02326 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 5.0726e-11 | | 57 | 6 | Accept | 0.051966 | 0.86077 | 0.02326 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 58 | 6 | Accept | 0.052197 | 1.8288 | 0.02326 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 2.8638 | | | | | | | | | | KernelScale: 201.68 | | 59 | 6 | Accept | 0.74165 | 11.549 | 0.02326 | 271 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 203 | | | | | | | | | | MinLeafSize: 3190 | | | | | | | | | | MaxNumSplits: 11 | | 60 | 6 | Accept | 0.74165 | 6.704 | 0.02326 | 271 | knn | NumNeighbors: 2890 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 61 | 6 | Accept | 0.74165 | 5.8589 | 0.02326 | 271 | knn | NumNeighbors: 762 | | 62 | 6 | Accept | 0.1133 | 3.0194 | 0.02326 | 271 | knn | NumNeighbors: 46 | | 63 | 6 | Accept | 0.049151 | 0.53626 | 0.02326 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 64 | 6 | Accept | 0.041767 | 4.6298 | 0.02326 | 1084 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 2.8638 | | | | | | | | | | KernelScale: 201.68 | | 65 | 6 | Accept | 0.74165 | 5.894 | 0.02326 | 271 | knn | NumNeighbors: 822 | | 66 | 6 | Accept | 0.056581 | 1.3414 | 0.02326 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 67 | 6 | Accept | 0.74165 | 5.5647 | 0.02326 | 271 | knn | NumNeighbors: 279 | | 68 | 6 | Accept | 0.15419 | 3.0206 | 0.02326 | 271 | knn | NumNeighbors: 54 | | 69 | 6 | Accept | 0.024691 | 45.811 | 0.02326 | 4334 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 213 | | | | | | | | | | MinLeafSize: 12 | | | | | | | | | | MaxNumSplits: 65 | | 70 | 6 | Best | 0.022614 | 11.185 | 0.022614 | 4334 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 432.63 | | | | | | | | | | KernelScale: 373.97 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 71 | 6 | Accept | 0.74165 | 9.802 | 0.022614 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.0010658 | | | | | | | | | | KernelScale: 0.1049 | | 72 | 6 | Accept | 0.73902 | 10.995 | 0.022614 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 32.297 | | | | | | | | | | KernelScale: 0.04955 | | 73 | 6 | Accept | 0.049797 | 0.58503 | 0.022614 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 74 | 6 | Accept | 0.74165 | 13.644 | 0.022614 | 271 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 254 | | | | | | | | | | MinLeafSize: 8596 | | | | | | | | | | MaxNumSplits: 73 | | 75 | 6 | Accept | 0.74165 | 11.107 | 0.022614 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.23597 | | | | | | | | | | KernelScale: 0.0011739 | | 76 | 6 | Accept | 0.048274 | 1.8954 | 0.022614 | 271 | knn | NumNeighbors: 2 | | 77 | 6 | Accept | 0.099903 | 2.4157 | 0.022614 | 271 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 223 | | | | | | | | | | MinLeafSize: 1 | | | | | | | | | | MaxNumSplits: 75 | | 78 | 6 | Accept | 0.74165 | 8.7174 | 0.022614 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.13626 | | | | | | | | | | KernelScale: 0.37002 | | 79 | 6 | Accept | 0.035444 | 6.7619 | 0.022614 | 1084 | knn | NumNeighbors: 2 | | 80 | 6 | Accept | 0.73943 | 11.389 | 0.022614 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 6.476 | | | | | | | | | | KernelScale: 0.024305 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 81 | 6 | Accept | 0.74165 | 0.16927 | 0.022614 | 271 | tree | MinLeafSize: 192 | | 82 | 6 | Accept | 0.28443 | 6.1819 | 0.022614 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 4.6764 | | | | | | | | | | KernelScale: 2.4604 | | 83 | 6 | Accept | 0.74165 | 5.5328 | 0.022614 | 271 | knn | NumNeighbors: 5216 | | 84 | 6 | Accept | 0.73994 | 10.148 | 0.022614 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.64248 | | | | | | | | | | KernelScale: 0.011614 | | 85 | 6 | Accept | 0.74165 | 5.4912 | 0.022614 | 271 | knn | NumNeighbors: 5719 | | 86 | 6 | Accept | 0.064658 | 0.56457 | 0.022614 | 271 | tree | MinLeafSize: 35 | | 87 | 6 | Accept | 0.038398 | 6.9574 | 0.022614 | 1084 | knn | NumNeighbors: 5 | | 88 | 6 | Accept | 0.034475 | 6.8188 | 0.022614 | 1084 | knn | NumNeighbors: 3 | | 89 | 6 | Accept | 0.74165 | 0.14527 | 0.022614 | 271 | tree | MinLeafSize: 2993 | | 90 | 6 | Accept | 0.058058 | 0.46957 | 0.022614 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 91 | 6 | Accept | 0.026629 | 22.134 | 0.022614 | 4334 | knn | NumNeighbors: 2 | | 92 | 6 | Accept | 0.74165 | 15.612 | 0.022614 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 278 | | | | | | | | | | MinLeafSize: 3475 | | | | | | | | | | MaxNumSplits: 38 | | 93 | 6 | Accept | 0.056258 | 0.62655 | 0.022614 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 94 | 6 | Accept | 0.050858 | 0.51896 | 0.022614 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 95 | 6 | Accept | 0.74165 | 5.8513 | 0.022614 | 271 | knn | NumNeighbors: 810 | | 96 | 6 | Accept | 0.061796 | 0.58768 | 0.022614 | 271 | tree | MinLeafSize: 35 | | 97 | 6 | Accept | 0.73002 | 62.357 | 0.022614 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 1.7322e-07 | | 98 | 6 | Accept | 0.064011 | 215.57 | 0.022614 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 2.3959 | | 99 | 6 | Accept | 0.046659 | 0.93439 | 0.022614 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 100 | 6 | Accept | 0.052889 | 0.48086 | 0.022614 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 101 | 6 | Accept | 0.10033 | 2.0363 | 0.022614 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.0041303 | | | | | | | | | | KernelScale: 185.74 | | 102 | 6 | Accept | 0.045782 | 0.48207 | 0.022614 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 103 | 6 | Accept | 0.042874 | 0.7858 | 0.022614 | 271 | tree | MinLeafSize: 1 | | 104 | 6 | Accept | 0.029167 | 1.4546 | 0.022614 | 1084 | tree | MinLeafSize: 1 | | 105 | 6 | Best | 0.020537 | 1.3072 | 0.020537 | 4334 | tree | MinLeafSize: 1 | | 106 | 6 | Accept | 0.41033 | 211.85 | 0.020537 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 68.422 | | 107 | 6 | Accept | 0.74165 | 5.4562 | 0.020537 | 271 | knn | NumNeighbors: 7694 | | 108 | 6 | Accept | 0.74165 | 0.29134 | 0.020537 | 271 | tree | MinLeafSize: 675 | | 109 | 5 | Accept | 0.72979 | 56.027 | 0.020537 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 7.594e-10 | | 110 | 5 | Accept | 0.047212 | 1.914 | 0.020537 | 271 | knn | NumNeighbors: 5 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 111 | 6 | Accept | 0.049982 | 0.50009 | 0.020537 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 112 | 6 | Accept | 0.051781 | 0.56465 | 0.020537 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 113 | 6 | Accept | 0.061658 | 0.50308 | 0.020537 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 114 | 6 | Accept | 0.73851 | 9.9938 | 0.020537 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 1.0952 | | | | | | | | | | KernelScale: 0.0011239 | | 115 | 6 | Best | 0.015507 | 143.46 | 0.015507 | 17335 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 432.63 | | | | | | | | | | KernelScale: 373.97 | | 116 | 6 | Accept | 0.038951 | 7.502 | 0.015507 | 1084 | knn | NumNeighbors: 5 | | 117 | 6 | Accept | 0.058658 | 2.2751 | 0.015507 | 271 | knn | NumNeighbors: 9 | | 118 | 6 | Accept | 0.56535 | 210.03 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 175.22 | | 119 | 6 | Accept | 0.050628 | 1.9935 | 0.015507 | 271 | knn | NumNeighbors: 4 | | 120 | 6 | Accept | 0.73126 | 9.0011 | 0.015507 | 271 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 230.2 | | | | | | | | | | KernelScale: 0.32321 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 121 | 6 | Accept | 0.51278 | 8.8728 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.011209 | | | | | | | | | | KernelScale: 1.0514 | | 122 | 6 | Accept | 0.037752 | 6.7081 | 0.015507 | 1084 | knn | NumNeighbors: 4 | | 123 | 6 | Accept | 0.74165 | 204.7 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 1679.5 | | 124 | 6 | Accept | 0.046751 | 1.8383 | 0.015507 | 271 | knn | NumNeighbors: 2 | | 125 | 6 | Accept | 0.73108 | 58.241 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 7.7951e-15 | | 126 | 6 | Accept | 0.74165 | 12.265 | 0.015507 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 216 | | | | | | | | | | MinLeafSize: 421 | | | | | | | | | | MaxNumSplits: 59 | | 127 | 6 | Accept | 0.048182 | 0.46464 | 0.015507 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 128 | 6 | Accept | 0.078687 | 0.736 | 0.015507 | 271 | tree | MinLeafSize: 12 | | 129 | 6 | Accept | 0.034429 | 6.89 | 0.015507 | 1084 | knn | NumNeighbors: 2 | | 130 | 6 | Accept | 0.74165 | 5.1529 | 0.015507 | 271 | knn | NumNeighbors: 893 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 131 | 6 | Accept | 0.04832 | 0.42408 | 0.015507 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 132 | 6 | Accept | 0.045828 | 0.40531 | 0.015507 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 133 | 6 | Accept | 0.74165 | 0.11469 | 0.015507 | 271 | tree | MinLeafSize: 943 | | 134 | 6 | Accept | 0.73163 | 58.558 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 4.0016e-08 | | 135 | 6 | Accept | 0.11732 | 0.47758 | 0.015507 | 271 | tree | MinLeafSize: 43 | | 136 | 6 | Accept | 0.051181 | 0.45611 | 0.015507 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 137 | 6 | Accept | 0.50757 | 116.52 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 0.005237 | | 138 | 6 | Accept | 0.74165 | 5.0747 | 0.015507 | 271 | knn | NumNeighbors: 2792 | | 139 | 6 | Accept | 0.74165 | 5.0727 | 0.015507 | 271 | knn | NumNeighbors: 1886 | | 140 | 6 | Accept | 0.27972 | 6.2223 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.0020942 | | | | | | | | | | KernelScale: 1.6249 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 141 | 6 | Accept | 0.04652 | 0.41269 | 0.015507 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 142 | 6 | Accept | 0.11565 | 0.45669 | 0.015507 | 271 | tree | MinLeafSize: 46 | | 143 | 6 | Accept | 0.045736 | 0.65924 | 0.015507 | 271 | tree | MinLeafSize: 2 | | 144 | 6 | Accept | 0.11621 | 0.39888 | 0.015507 | 271 | tree | MinLeafSize: 59 | | 145 | 6 | Accept | 0.026721 | 20.503 | 0.015507 | 4334 | knn | NumNeighbors: 2 | | 146 | 6 | Accept | 0.29744 | 7.5199 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 318.91 | | | | | | | | | | KernelScale: 1.4414 | | 147 | 6 | Accept | 0.026814 | 1.3329 | 0.015507 | 1084 | tree | MinLeafSize: 2 | | 148 | 6 | Accept | 0.020537 | 1.1856 | 0.015507 | 4334 | tree | MinLeafSize: 2 | | 149 | 6 | Accept | 0.74165 | 5.0812 | 0.015507 | 271 | knn | NumNeighbors: 9834 | | 150 | 6 | Accept | 0.74165 | 4.9886 | 0.015507 | 271 | knn | NumNeighbors: 3626 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 151 | 6 | Accept | 0.10638 | 1.9037 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.35259 | | | | | | | | | | KernelScale: 56.147 | | 152 | 6 | Accept | 0.049012 | 0.70414 | 0.015507 | 271 | tree | MinLeafSize: 1 | | 153 | 6 | Accept | 0.023537 | 1.4334 | 0.015507 | 1084 | tree | MinLeafSize: 1 | | 154 | 5 | Accept | 0.73011 | 60.803 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 1.8217e-05 | | 155 | 5 | Accept | 0.73486 | 8.5215 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.0023583 | | | | | | | | | | KernelScale: 0.24236 | | 156 | 6 | Accept | 0.047074 | 1.0388 | 0.015507 | 271 | tree | MinLeafSize: 1 | | 157 | 6 | Accept | 0.70237 | 8.6088 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.062538 | | | | | | | | | | KernelScale: 0.37767 | | 158 | 6 | Accept | 0.74165 | 4.9997 | 0.015507 | 271 | knn | NumNeighbors: 323 | | 159 | 6 | Accept | 0.029675 | 1.4729 | 0.015507 | 1084 | tree | MinLeafSize: 1 | | 160 | 6 | Accept | 0.74165 | 9.302 | 0.015507 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 214 | | | | | | | | | | MinLeafSize: 775 | | | | | | | | | | MaxNumSplits: 50 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 161 | 6 | Accept | 0.37119 | 3.7119 | 0.015507 | 271 | knn | NumNeighbors: 115 | | 162 | 6 | Accept | 0.74165 | 5.107 | 0.015507 | 271 | knn | NumNeighbors: 4695 | | 163 | 6 | Accept | 0.048043 | 0.5202 | 0.015507 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 164 | 6 | Accept | 0.044951 | 0.46331 | 0.015507 | 271 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 165 | 6 | Accept | 0.74165 | 12.879 | 0.015507 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 284 | | | | | | | | | | MinLeafSize: 4201 | | | | | | | | | | MaxNumSplits: 68 | | 166 | 6 | Accept | 0.049243 | 1.7758 | 0.015507 | 271 | knn | NumNeighbors: 2 | | 167 | 6 | Accept | 0.59004 | 90.952 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 0.0015851 | | 168 | 6 | Accept | 0.050858 | 0.47237 | 0.015507 | 1084 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 169 | 6 | Accept | 0.021276 | 1.3237 | 0.015507 | 4334 | tree | MinLeafSize: 1 | | 170 | 6 | Accept | 0.033183 | 19.828 | 0.015507 | 271 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 292 | | | | | | | | | | MinLeafSize: 12 | | | | | | | | | | MaxNumSplits: 85 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 171 | 6 | Accept | 0.11422 | 2.7931 | 0.015507 | 271 | knn | NumNeighbors: 41 | | 172 | 6 | Accept | 0.74165 | 0.10587 | 0.015507 | 271 | tree | MinLeafSize: 708 | | 173 | 6 | Accept | 0.73929 | 10.665 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.44289 | | | | | | | | | | KernelScale: 0.0062786 | | 174 | 6 | Accept | 0.73076 | 53.017 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 1.203e-13 | | 175 | 6 | Accept | 0.058058 | 1.9539 | 0.015507 | 271 | knn | NumNeighbors: 6 | | 176 | 6 | Accept | 0.73076 | 4.041 | 0.015507 | 271 | knn | NumNeighbors: 131 | | 177 | 6 | Accept | 0.01583 | 6.3126 | 0.015507 | 17335 | tree | MinLeafSize: 1 | | 178 | 6 | Accept | 0.05635 | 6.521 | 0.015507 | 271 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 216 | | | | | | | | | | MinLeafSize: 2 | | | | | | | | | | MaxNumSplits: 42 | | 179 | 6 | Accept | 0.74165 | 5.2228 | 0.015507 | 271 | knn | NumNeighbors: 3347 | | 180 | 6 | Accept | 0.74165 | 5.12 | 0.015507 | 271 | knn | NumNeighbors: 4390 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 181 | 6 | Accept | 0.09401 | 2.3294 | 0.015507 | 271 | knn | NumNeighbors: 24 | | 182 | 6 | Accept | 0.27811 | 5.2153 | 0.015507 | 271 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 35.627 | | | | | | | | | | KernelScale: 3.1484 | | 183 | 6 | Accept | 0.07038 | 2.0202 | 0.015507 | 271 | knn | NumNeighbors: 10 | | 184 | 6 | Accept | 0.035167 | 6.3428 | 0.015507 | 1084 | knn | NumNeighbors: 2 | | 185 | 6 | Accept | 0.051874 | 0.73088 | 0.015507 | 271 | tree | MinLeafSize: 3 | | 186 | 6 | Accept | 0.26241 | 0.25171 | 0.015507 | 271 | tree | MinLeafSize: 79 | | 187 | 6 | Accept | 0.74165 | 5.2683 | 0.015507 | 271 | knn | NumNeighbors: 3004 | | 188 | 6 | Accept | 0.7314 | 54.858 | 0.015507 | 271 | nb | DistributionNames: kernel | | | | | | | | | | Width: 7.872e-07 | | 189 | 6 | Accept | 0.030321 | 1.4975 | 0.015507 | 1084 | tree | MinLeafSize: 3 | | 190 | 6 | Accept | 0.74165 | 5.4671 | 0.015507 | 271 | knn | NumNeighbors: 9464 | |========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Training set | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | size | | | |========================================================================================================================================| | 191 | 6 | Accept | 0.74165 | 5.3621 | 0.015507 | 271 | knn | NumNeighbors: 748 | | 192 | 6 | Accept | 0.054735 | 2.0058 | 0.015507 | 271 | knn | NumNeighbors: 6 | | 193 | 6 | Accept | 0.74165 | 11.604 | 0.015507 | 271 | ensemble | Method: AdaBoostM2 | | | | | ... ```

```__________________________________________________________ Optimization completed. Total iterations: 510 Total elapsed time: 1229.4372 seconds Total time for training and validation: 6958.3168 seconds Best observed learner is an ensemble model with: Method: AdaBoostM2 NumLearningCycles: 213 MinLeafSize: 7 MaxNumSplits: 82 Observed validation loss: 0.0035998 Time for training and validation: 83.6534 seconds Documentation for fitcauto display ```

The final model returned by `fitcauto` corresponds to the best observed learner. Before returning the model, the function retrains it using all the training data (`XTrain` and `YTrain`), the listed `Learner` (or model) type, and the displayed hyperparameter values.

Evaluate Test Set Performance

Evaluate the final model performance on the test data set.

`testAccuracy = 1 - loss(Mdl,XTest,YTest)`
```testAccuracy = 0.9963 ```

The final model correctly classifies over 99% of the observations.

Use `fitcauto` to automatically select a classification model with optimized hyperparameters, given predictor and response data stored in a table. Before passing data to `fitcauto`, perform feature selection to remove unimportant predictors from the data set.

Read the sample file `CreditRating_Historical.dat` into a table. The predictor data consists of financial ratios and industry sector information for a list of corporate customers. The response variable consists of credit ratings assigned by a rating agency. Preview the first few rows of the data set.

```creditrating = readtable("CreditRating_Historical.dat"); head(creditrating)```
```ans=8×8 table ID WC_TA RE_TA EBIT_TA MVE_BVTD S_TA Industry Rating _____ ______ ______ _______ ________ _____ ________ _______ 62394 0.013 0.104 0.036 0.447 0.142 3 {'BB' } 48608 0.232 0.335 0.062 1.969 0.281 8 {'A' } 42444 0.311 0.367 0.074 1.935 0.366 1 {'A' } 48631 0.194 0.263 0.062 1.017 0.228 4 {'BBB'} 43768 0.121 0.413 0.057 3.647 0.466 12 {'AAA'} 39255 -0.117 -0.799 0.01 0.179 0.082 4 {'CCC'} 62236 0.087 0.158 0.049 0.816 0.324 2 {'BBB'} 39354 0.005 0.181 0.034 2.597 0.388 7 {'AA' } ```

Because each value in the `ID` variable is a unique customer ID, that is, `length(unique(creditrating.ID))` is equal to the number of observations in `creditrating`, the `ID` variable is a poor predictor. Remove the `ID` variable from the table, and convert the `Industry` variable to a `categorical` variable.

```creditrating = removevars(creditrating,"ID"); creditrating.Industry = categorical(creditrating.Industry);```

Partition the data into training and test sets. Use approximately 85% of the observations for the model selection and hyperparameter tuning process, and 15% of the observations to test the performance of the final model returned by `fitcauto` on new data. Use `cvpartition` to partition the data.

```rng("default") % For reproducibility of the partition c = cvpartition(creditrating.Rating,"Holdout",0.15); trainingIndices = training(c); % Indices for the training set testIndices = test(c); % Indices for the test set creditTrain = creditrating(trainingIndices,:); creditTest = creditrating(testIndices,:);```

Perform Feature Selection

Before passing the training data to `fitcauto`, find the important predictors by using the `fscchi2` function. Visualize the predictor scores by using the `bar` function. Because some scores can be `Inf`, and `bar` discards `Inf` values, plot the finite scores first and then plot a finite representation of the `Inf` scores in a different color.

```[idx,scores] = fscchi2(creditTrain,"Rating"); bar(scores(idx)) % Represents finite scores hold on veryImportant = isinf(scores); finiteMax = max(scores(~veryImportant)); bar(finiteMax*veryImportant(idx)) % Represents Inf scores hold off xticklabels(strrep(creditTrain.Properties.VariableNames(idx),"_","\_")) xtickangle(45) legend(["Finite Scores","Inf Scores"])```

Notice that the `Industry` predictor has a low score corresponding to a p-value that is greater than 0.05, which indicates that `Industry` might not be an important feature. Remove the `Industry` feature from the training and test data sets.

```creditTrain = removevars(creditTrain,'Industry'); creditTest = removevars(creditTest,'Industry');```

Run `fitcauto`

Pass the training data to `fitcauto`. The function uses Bayesian optimization to select models and their hyperparameter values, and returns a trained model `Mdl` with the best expected performance. Specify to try all available learner types and run the optimization in parallel (requires Parallel Computing Toolbox™). Return a second output `Results` that contains the details of the Bayesian optimization.

Expect this process to take some time. By default, `fitcauto` provides a plot of the optimization and an iterative display of the optimization results. For more information on how to interpret these results, see Verbose Display.

```options = struct("UseParallel",true); [Mdl,Results] = fitcauto(creditTrain,"Rating", ... "Learners","all","HyperparameterOptimizationOptions",options);```
```Warning: It is recommended that you first standardize all numeric predictors when optimizing the Naive Bayes 'Width' parameter. Ignore this warning if you have done that. ```
```Starting parallel pool (parpool) using the 'local' profile ... Connected to the parallel pool (number of workers: 6). Copying objective function to workers... Done copying objective function to workers. Learner types to explore: discr, ensemble, kernel, knn, linear, nb, svm, tree Total iterations (MaxObjectiveEvaluations): 240 Total time (MaxTime): Inf |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 1 | 6 | Best | 0.42716 | 4.9077 | 0.42716 | 0.42716 | discr | Delta: 0.00046441 | | | | | | | | | | Gamma: 0.2485 | | 2 | 4 | Accept | 0.74185 | 7.2984 | 0.24948 | 0.29794 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.48455 | | | | | | | | | | KernelScale: 354.44 | | 3 | 4 | Best | 0.24948 | 7.9291 | 0.24948 | 0.29794 | linear | Coding: onevsone | | | | | | | | | | Lambda: 6.3551e-08 | | | | | | | | | | Learner: logistic | | 4 | 4 | Accept | 0.29794 | 6.1613 | 0.24948 | 0.29794 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 12 | | | | | | | | | | LearnRate: 0.063776 | | | | | | | | | | MinLeafSize: 277 | | 5 | 4 | Accept | 0.25067 | 1.155 | 0.24948 | 0.25067 | knn | NumNeighbors: 105 | | | | | | | | | | Distance: minkowski | | 6 | 6 | Accept | 0.52917 | 2.3222 | 0.24948 | 0.25067 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.002417 | | | | | | | | | | KernelScale: 356.9 | | 7 | 4 | Accept | 0.6904 | 1.5015 | 0.24948 | 0.29794 | knn | NumNeighbors: 255 | | | | | | | | | | Distance: jaccard | | 8 | 4 | Accept | 0.6904 | 1.3877 | 0.24948 | 0.29794 | knn | NumNeighbors: 255 | | | | | | | | | | Distance: jaccard | | 9 | 4 | Accept | 0.6904 | 1.3696 | 0.24948 | 0.29794 | knn | NumNeighbors: 255 | | | | | | | | | | Distance: jaccard | | 10 | 4 | Accept | 0.55818 | 1.0769 | 0.24948 | 0.29794 | discr | Delta: 0.98612 | | | | | | | | | | Gamma: 0.86519 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 11 | 6 | Best | 0.24649 | 17.118 | 0.24649 | 0.24649 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 7.8433 | | | | | | | | | | Lambda: 1.4468e-06 | | 12 | 6 | Accept | 0.26413 | 1.1368 | 0.24649 | 0.24649 | tree | MinLeafSize: 30 | | 13 | 6 | Accept | 0.45169 | 1.5112 | 0.24649 | 0.24649 | linear | Coding: onevsall | | | | | | | | | | Lambda: 0.0028505 | | | | | | | | | | Learner: svm | | 14 | 6 | Accept | 0.42238 | 1.5531 | 0.24649 | 0.24649 | linear | Coding: onevsall | | | | | | | | | | Lambda: 0.0016864 | | | | | | | | | | Learner: logistic | | 15 | 6 | Accept | 0.27311 | 12.485 | 0.24649 | 0.26086 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 41.969 | | | | | | | | | | Lambda: 9.9891e-06 | | 16 | 6 | Accept | 0.29584 | 2.4339 | 0.24649 | 0.26086 | linear | Coding: onevsone | | | | | | | | | | Lambda: 0.037043 | | | | | | | | | | Learner: svm | | 17 | 6 | Accept | 0.33712 | 0.26108 | 0.24649 | 0.26086 | knn | NumNeighbors: 1 | | | | | | | | | | Distance: cityblock | | 18 | 6 | Accept | 0.53365 | 2.2181 | 0.24649 | 0.26086 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.0022255 | | | | | | | | | | KernelScale: 206.47 | | 19 | 6 | Accept | 0.4834 | 1.1776 | 0.24649 | 0.26086 | knn | NumNeighbors: 72 | | | | | | | | | | Distance: correlation | | 20 | 6 | Accept | 0.46066 | 18.794 | 0.24649 | 0.26086 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 47.05 | | | | | | | | | | KernelScale: 0.46846 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 21 | 6 | Accept | 0.46066 | 19.722 | 0.24649 | 0.26086 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 47.05 | | | | | | | | | | KernelScale: 0.46846 | | 22 | 6 | Accept | 0.46066 | 19.978 | 0.24649 | 0.26086 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 47.05 | | | | | | | | | | KernelScale: 0.46846 | | 23 | 6 | Accept | 0.74185 | 0.72736 | 0.24649 | 0.26086 | tree | MinLeafSize: 1558 | | 24 | 4 | Accept | 0.25157 | 4.2545 | 0.24379 | 0.26086 | nb | DistributionNames: kernel | | | | | | | | | | Width: 0.11323 | | 25 | 4 | Best | 0.24379 | 2.7132 | 0.24379 | 0.26086 | linear | Coding: onevsone | | | | | | | | | | Lambda: 9.2928e-05 | | | | | | | | | | Learner: logistic | | 26 | 4 | Accept | 0.43255 | 0.37506 | 0.24379 | 0.26086 | discr | Delta: 0.016844 | | | | | | | | | | Gamma: 0.64466 | | 27 | 6 | Accept | 0.66796 | 0.25716 | 0.24379 | 0.26086 | knn | NumNeighbors: 77 | | | | | | | | | | Distance: jaccard | | 28 | 4 | Accept | 0.25366 | 2.6872 | 0.24379 | 0.26086 | nb | DistributionNames: kernel | | | | | | | | | | Width: 0.10033 | | 29 | 4 | Accept | 0.66796 | 0.33779 | 0.24379 | 0.26086 | knn | NumNeighbors: 77 | | | | | | | | | | Distance: jaccard | | 30 | 4 | Accept | 0.66796 | 0.29903 | 0.24379 | 0.26086 | knn | NumNeighbors: 77 | | | | | | | | | | Distance: jaccard | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 31 | 4 | Accept | 0.2773 | 0.74879 | 0.24379 | 0.26086 | tree | MinLeafSize: 94 | | 32 | 3 | Accept | 0.25606 | 11.512 | 0.24379 | 0.26086 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 132 | | | | | | | | | | LearnRate: 0.92674 | | | | | | | | | | MinLeafSize: 127 | | 33 | 3 | Accept | 0.74185 | 0.89783 | 0.24379 | 0.26086 | discr | Delta: 244.12 | | | | | | | | | | Gamma: 0.23748 | | 34 | 6 | Accept | 0.43075 | 0.10207 | 0.24379 | 0.26086 | discr | Delta: 0.0014341 | | | | | | | | | | Gamma: 0.70025 | | 35 | 6 | Accept | 0.24738 | 2.4047 | 0.24379 | 0.26086 | linear | Coding: onevsone | | | | | | | | | | Lambda: 0.0028343 | | | | | | | | | | Learner: logistic | | 36 | 6 | Accept | 0.3787 | 1.8766 | 0.24379 | 0.26086 | linear | Coding: onevsall | | | | | | | | | | Lambda: 1.4563e-06 | | | | | | | | | | Learner: logistic | | 37 | 6 | Accept | 0.53814 | 2.1153 | 0.24379 | 0.26086 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 6.8148 | | | | | | | | | | KernelScale: 382.11 | | 38 | 6 | Accept | 0.2761 | 0.22606 | 0.24379 | 0.26086 | tree | MinLeafSize: 87 | | 39 | 6 | Accept | 0.42208 | 0.77835 | 0.24379 | 0.26086 | discr | Delta: 0.0090118 | | | | | | | | | | Gamma: 0.062207 | | 40 | 6 | Accept | 0.42656 | 0.13226 | 0.24379 | 0.26086 | discr | Delta: 0.0020866 | | | | | | | | | | Gamma: 0.091054 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 41 | 6 | Accept | 0.29973 | 0.41653 | 0.24379 | 0.26086 | tree | MinLeafSize: 7 | | 42 | 6 | Accept | 0.25247 | 12.99 | 0.24379 | 0.25743 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 0.53464 | | | | | | | | | | Lambda: 2.6732e-05 | | 43 | 6 | Accept | 0.25965 | 13.385 | 0.24379 | 0.25743 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 150 | | | | | | | | | | LearnRate: 0.014842 | | | | | | | | | | MinLeafSize: 21 | | 44 | 6 | Accept | 0.28059 | 0.87454 | 0.24379 | 0.25743 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 45 | 6 | Accept | 0.27281 | 0.44508 | 0.24379 | 0.25743 | knn | NumNeighbors: 8 | | | | | | | | | | Distance: chebychev | | 46 | 6 | Accept | 0.2767 | 17.125 | 0.24379 | 0.25743 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 221 | | | | | | | | | | LearnRate: 0.0028588 | | | | | | | | | | MinLeafSize: 1 | | 47 | 5 | Accept | 0.24499 | 9.7866 | 0.24379 | 0.25743 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.019387 | | | | | | | | | | KernelScale: 0.0047515 | | 48 | 5 | Accept | 0.42178 | 0.93955 | 0.24379 | 0.25743 | discr | Delta: 6.8395e-06 | | | | | | | | | | Gamma: 0.058174 | | 49 | 6 | Best | 0.2429 | 1.5919 | 0.2429 | 0.25743 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.16719 | | | | | | | | | | KernelScale: 0.11257 | | 50 | 6 | Accept | 0.74185 | 10.422 | 0.2429 | 0.26136 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 24.681 | | | | | | | | | | Lambda: 0.092669 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 51 | 6 | Accept | 0.59049 | 3.0832 | 0.2429 | 0.26136 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 0.093586 | | | | | | | | | | Lambda: 0.0050756 | | 52 | 6 | Accept | 0.37571 | 0.17679 | 0.2429 | 0.26136 | tree | MinLeafSize: 473 | | 53 | 6 | Accept | 0.27251 | 0.16627 | 0.2429 | 0.26136 | tree | MinLeafSize: 20 | | 54 | 6 | Accept | 0.32994 | 0.26792 | 0.2429 | 0.26136 | tree | MinLeafSize: 3 | | 55 | 6 | Accept | 0.61412 | 9.4509 | 0.2429 | 0.26136 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 0.093586 | | | | | | | | | | Lambda: 0.0050756 | | 56 | 6 | Accept | 0.29973 | 0.19258 | 0.2429 | 0.26136 | tree | MinLeafSize: 7 | | 57 | 6 | Accept | 0.43225 | 0.11614 | 0.2429 | 0.26136 | discr | Delta: 0.021467 | | | | | | | | | | Gamma: 0.66016 | | 58 | 6 | Accept | 0.25725 | 29.083 | 0.2429 | 0.26136 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 304 | | | | | | | | | | LearnRate: NaN | | | | | | | | | | MinLeafSize: 100 | | 59 | 5 | Accept | 0.33144 | 1.4617 | 0.2429 | 0.26995 | nb | DistributionNames: kernel | | | | | | | | | | Width: 0.0020049 | | 60 | 5 | Accept | 0.28059 | 0.57622 | 0.2429 | 0.26995 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 61 | 6 | Accept | 0.24708 | 8.0326 | 0.2429 | 0.26995 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 4.6933 | | | | | | | | | | Lambda: 9.8945e-07 | | 62 | 6 | Accept | 0.24768 | 7.9544 | 0.2429 | 0.25978 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 4.6933 | | | | | | | | | | Lambda: 9.8945e-07 | | 63 | 6 | Accept | 0.55369 | 0.86731 | 0.2429 | 0.25978 | knn | NumNeighbors: 615 | | | | | | | | | | Distance: correlation | | 64 | 5 | Accept | 0.31947 | 13.444 | 0.2429 | 0.25978 | ensemble | Method: RUSBoost | | | | | | | | | | NumLearningCycles: 132 | | | | | | | | | | LearnRate: 0.0014516 | | | | | | | | | | MinLeafSize: 104 | | 65 | 5 | Accept | 0.57972 | 3.0436 | 0.2429 | 0.25978 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.12255 | | | | | | | | | | KernelScale: 81.172 | | 66 | 6 | Accept | 0.42596 | 0.12397 | 0.2429 | 0.25978 | discr | Delta: 9.4222e-06 | | | | | | | | | | Gamma: 0.15603 | | 67 | 6 | Accept | 0.42596 | 0.1062 | 0.2429 | 0.25978 | discr | Delta: 9.4222e-06 | | | | | | | | | | Gamma: 0.15603 | | 68 | 6 | Accept | 0.67783 | 0.82135 | 0.2429 | 0.25978 | linear | Coding: onevsall | | | | | | | | | | Lambda: 2.4732 | | | | | | | | | | Learner: logistic | | 69 | 6 | Accept | 0.25695 | 0.39058 | 0.2429 | 0.25978 | knn | NumNeighbors: 14 | | | | | | | | | | Distance: cityblock | | 70 | 6 | Accept | 0.74185 | 1.9769 | 0.2429 | 0.25978 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.94197 | | | | | | | | | | KernelScale: 524.56 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 71 | 6 | Accept | 0.6548 | 3.5066 | 0.2429 | 0.25978 | nb | DistributionNames: kernel | | | | | | | | | | Width: 2.6013 | | 72 | 6 | Accept | 0.60694 | 2.3559 | 0.2429 | 0.25764 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 0.86904 | | | | | | | | | | Lambda: 0.29724 | | 73 | 6 | Accept | 0.42926 | 0.10372 | 0.2429 | 0.25764 | discr | Delta: 0.041145 | | | | | | | | | | Gamma: 0.34864 | | 74 | 6 | Accept | 0.47383 | 0.10921 | 0.2429 | 0.25764 | tree | MinLeafSize: 793 | | 75 | 6 | Accept | 0.32456 | 0.20983 | 0.2429 | 0.25764 | tree | MinLeafSize: 5 | | 76 | 6 | Accept | 0.43703 | 1.1803 | 0.2429 | 0.25764 | linear | Coding: onevsall | | | | | | | | | | Lambda: 0.013265 | | | | | | | | | | Learner: logistic | | 77 | 6 | Accept | 0.38169 | 0.13279 | 0.2429 | 0.25764 | tree | MinLeafSize: 436 | | 78 | 6 | Accept | 0.25845 | 20.668 | 0.2429 | 0.25764 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 160 | | | | | | | | | | LearnRate: NaN | | | | | | | | | | MinLeafSize: 2 | | 79 | 6 | Accept | 0.43015 | 0.10705 | 0.2429 | 0.25764 | discr | Delta: 0.0069822 | | | | | | | | | | Gamma: 0.49526 | | 80 | 6 | Accept | 0.42208 | 0.098978 | 0.2429 | 0.25764 | discr | Delta: 0.057485 | | | | | | | | | | Gamma: 0.045714 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 81 | 6 | Accept | 0.33503 | 0.40026 | 0.2429 | 0.25764 | knn | NumNeighbors: 2 | | | | | | | | | | Distance: minkowski | | 82 | 6 | Accept | 0.52617 | 2.0596 | 0.2429 | 0.25764 | svm | Coding: onevsall | | | | | | | | | | BoxConstraint: 0.26869 | | | | | | | | | | KernelScale: 17.595 | | 83 | 6 | Accept | 0.32905 | 0.46647 | 0.2429 | 0.25764 | knn | NumNeighbors: 65 | | | | | | | | | | Distance: seuclidean | | 84 | 6 | Accept | 0.25127 | 11.058 | 0.2429 | 0.25598 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.78697 | | | | | | | | | | Lambda: 4.1197e-06 | | 85 | 6 | Accept | 0.26922 | 13.745 | 0.2429 | 0.25598 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 168 | | | | | | | | | | LearnRate: 0.0041733 | | | | | | | | | | MinLeafSize: 3 | | 86 | 6 | Accept | 0.24589 | 4.5176 | 0.2429 | 0.24982 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 1.0908 | | | | | | | | | | Lambda: 7.5756e-05 | | 87 | 6 | Accept | 0.2429 | 2.5827 | 0.2429 | 0.24982 | linear | Coding: onevsone | | | | | | | | | | Lambda: 4.7032e-08 | | | | | | | | | | Learner: svm | | 88 | 6 | Accept | 0.67873 | 4.8803 | 0.2429 | 0.24941 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 66.432 | | | | | | | | | | Lambda: 0.00097982 | | 89 | 6 | Accept | 0.28059 | 0.11127 | 0.2429 | 0.24941 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 90 | 6 | Accept | 0.25905 | 2.3728 | 0.2429 | 0.24941 | nb | DistributionNames: kernel | | | | | | | | | | Width: 0.054786 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 91 | 6 | Accept | 0.50972 | 4.7902 | 0.2429 | 0.24941 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 53 | | | | | | | | | | LearnRate: NaN | | | | | | | | | | MinLeafSize: 926 | | 92 | 6 | Accept | 0.28059 | 0.49389 | 0.2429 | 0.24941 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 93 | 6 | Accept | 0.42926 | 0.12299 | 0.2429 | 0.24941 | discr | Delta: 0.00083172 | | | | | | | | | | Gamma: 0.41309 | | 94 | 6 | Accept | 0.29704 | 1.5229 | 0.2429 | 0.24941 | ensemble | Method: AdaBoostM2 | | | | | | | | | | NumLearningCycles: 11 | | | | | | | | | | LearnRate: 0.0072731 | | | | | | | | | | MinLeafSize: 12 | | 95 | 6 | Accept | 0.28059 | 0.12303 | 0.2429 | 0.24941 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 96 | 6 | Accept | 0.28059 | 0.11495 | 0.2429 | 0.24941 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 97 | 6 | Accept | 0.29225 | 13.443 | 0.2429 | 0.24941 | ensemble | Method: RUSBoost | | | | | | | | | | NumLearningCycles: 147 | | | | | | | | | | LearnRate: 0.95321 | | | | | | | | | | MinLeafSize: 112 | | 98 | 6 | Best | 0.2411 | 2.2875 | 0.2411 | 0.24941 | linear | Coding: onevsone | | | | | | | | | | Lambda: 0.00056045 | | | | | | | | | | Learner: svm | | 99 | 6 | Accept | 0.74185 | 0.11928 | 0.2411 | 0.24941 | discr | Delta: 39.281 | | | | | | | | | | Gamma: 0.77032 | | 100 | 6 | Accept | 0.30093 | 0.13456 | 0.2411 | 0.24941 | tree | MinLeafSize: 135 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 101 | 6 | Accept | 0.46844 | 0.18889 | 0.2411 | 0.24941 | knn | NumNeighbors: 2 | | | | | | | | | | Distance: cosine | | 102 | 6 | Accept | 0.24469 | 2.2937 | 0.2411 | 0.24727 | linear | Coding: onevsone | | | | | | | | | | Lambda: 0.0012413 | | | | | | | | | | Learner: logistic | | 103 | 6 | Accept | 0.25426 | 3.6479 | 0.2411 | 0.24727 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 38 | | | | | | | | | | LearnRate: NaN | | | | | | | | | | MinLeafSize: 28 | | 104 | 6 | Accept | 0.24529 | 167.51 | 0.2411 | 0.24727 | svm | Coding: onevsone | | | | | | | | | | BoxConstraint: 0.25488 | | | | | | | | | | KernelScale: 0.0037823 | | 105 | 6 | Accept | 0.31977 | 1.9252 | 0.2411 | 0.24891 | linear | Coding: onevsone | | | | | | | | | | Lambda: 0.040102 | | | | | | | | | | Learner: logistic | | 106 | 6 | Accept | 0.50045 | 4.6994 | 0.2411 | 0.24891 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 13.293 | | | | | | | | | | Lambda: 0.0031304 | | 107 | 6 | Accept | 0.37152 | 0.14955 | 0.2411 | 0.24891 | tree | MinLeafSize: 375 | | 108 | 6 | Accept | 0.24678 | 2.9213 | 0.2411 | 0.24541 | linear | Coding: onevsone | | | | | | | | | | Lambda: 3.9918e-05 | | | | | | | | | | Learner: logistic | | 109 | 6 | Accept | 0.74484 | 4.8397 | 0.2411 | 0.24541 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.004545 | | | | | | | | | | Lambda: 0.0039369 | | 110 | 6 | Accept | 0.45947 | 0.73222 | 0.2411 | 0.24662 | linear | Coding: onevsall | | | | | | | | | | Lambda: 0.028513 | | | | | | | | | | Learner: svm | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 111 | 6 | Accept | 0.28059 | 0.11129 | 0.2411 | 0.24662 | nb | DistributionNames: normal | | | | | | | | | | Width: NaN | | 112 | 6 | Accept | 0.25845 | 7.4048 | 0.2411 | 0.24662 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 61 | | | | | | | | | | LearnRate: NaN | | | | | | | | | | MinLeafSize: 3 | | 113 | 6 | Accept | 0.42806 | 0.20953 | 0.2411 | 0.24662 | knn | NumNeighbors: 10 | | | | | | | | | | Distance: cosine | | 114 | 6 | Accept | 0.74185 | 3.5296 | 0.2411 | 0.24662 | nb | DistributionNames: kernel | | | | | | | | | | Width: 74.975 | | 115 | 6 | Accept | 0.29106 | 21.854 | 0.2411 | 0.24662 | ensemble | Method: Bag | | | | | | | | | | NumLearningCycles: 249 | | | | | | | | | | LearnRate: NaN | | | | | | | | | | MinLeafSize: 292 | | 116 | 6 | Accept | 0.77864 | 10.34 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.0050713 | | | | | | | | | | Lambda: 3.7406e-06 | | 117 | 6 | Accept | 0.24708 | 5.2433 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.8979 | | | | | | | | | | Lambda: 0.00028514 | | 118 | 6 | Accept | 0.71762 | 4.9096 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 500.74 | | | | | | | | | | Lambda: 7.9516e-05 | | 119 | 6 | Accept | 0.7601 | 12.416 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.013078 | | | | | | | | | | Lambda: 0.00023088 | | 120 | 6 | Accept | 0.31289 | 3.9454 | 0.2411 | 0.24662 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 4.8535 | | | | | | | | | | Lambda: 0.00015045 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 121 | 6 | Accept | 0.68771 | 3.8043 | 0.2411 | 0.24662 | kernel | Coding: onevsall | | | | | | | | | | KernelScale: 553.29 | | | | | | | | | | Lambda: 2.0294e-05 | | 122 | 6 | Accept | 0.24948 | 6.555 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.69606 | | | | | | | | | | Lambda: 5.6834e-05 | | 123 | 6 | Accept | 0.24649 | 6.265 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 1.5014 | | | | | | | | | | Lambda: 7.4113e-05 | | 124 | 6 | Accept | 0.24649 | 6.2611 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.75029 | | | | | | | | | | Lambda: 8.0356e-05 | | 125 | 6 | Accept | 0.25217 | 10.816 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.8744 | | | | | | | | | | Lambda: 3.9465e-06 | | 126 | 6 | Accept | 0.25755 | 0.25578 | 0.2411 | 0.24662 | knn | NumNeighbors: 133 | | | | | | | | | | Distance: minkowski | | 127 | 6 | Accept | 0.24589 | 5.6905 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 1.0841 | | | | | | | | | | Lambda: 0.00019 | | 128 | 6 | Accept | 0.25366 | 6.0616 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 13.915 | | | | | | | | | | Lambda: 4.7818e-05 | | 129 | 5 | Accept | 0.3111 | 19.355 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.23685 | | | | | | | | | | Lambda: 3.4559e-07 | | 130 | 5 | Accept | 0.24649 | 6.139 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.89435 | | | | | | | | | | Lambda: 0.00018696 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 131 | 6 | Accept | 0.24798 | 5.2185 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 1.9045 | | | | | | | | | | Lambda: 0.00021312 | | 132 | 6 | Accept | 0.24828 | 5.4701 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 1.3796 | | | | | | | | | | Lambda: 0.00034835 | | 133 | 6 | Accept | 0.28896 | 8.0051 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.18555 | | | | | | | | | | Lambda: 5.7486e-05 | | 134 | 6 | Accept | 0.24738 | 0.22382 | 0.2411 | 0.24662 | knn | NumNeighbors: 98 | | | | | | | | | | Distance: minkowski | | 135 | 6 | Accept | 0.24678 | 6.1613 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 3.8708 | | | | | | | | | | Lambda: 0.00022901 | | 136 | 5 | Accept | 0.24529 | 5.7754 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.98622 | | | | | | | | | | Lambda: 0.00022785 | | 137 | 5 | Accept | 0.277 | 0.63033 | 0.2411 | 0.24662 | knn | NumNeighbors: 197 | | | | | | | | | | Distance: minkowski | | 138 | 6 | Accept | 0.25636 | 5.2351 | 0.2411 | 0.24662 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 5.9871 | | | | | | | | | | Lambda: 0.00025502 | | 139 | 6 | Accept | 0.24589 | 5.4419 | 0.2411 | 0.24661 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.71386 | | | | | | | | | | Lambda: 0.00023876 | | 140 | 6 | Accept | 0.24828 | 5.1049 | 0.2411 | 0.24617 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 0.93977 | | | | | | | | | | Lambda: 0.00056651 | |===========================================================================================================================================| | Iter | Active | Eval | Validation | Time for training | Observed min | Estimated min | Learner | Hyperparameter: Value | | | workers | result | loss | & validation (sec)| validation loss | validation loss | | | |===========================================================================================================================================| | 141 | 6 | Accept | 0.27879 | 5.6359 | 0.2411 | 0.24618 | kernel | Coding: onevsone | | | | | | | | | | KernelScale: 21.38 | | ... ```

```__________________________________________________________ Optimization completed. Total iterations: 240 Total elapsed time: 608.1602 seconds Total time for training and validation: 1585.7079 seconds Best observed learner is a multiclass svm model with: Coding (ECOC): onevsone BoxConstraint: 0.85149 KernelScale: 0.48514 Observed validation loss: 0.23961 Time for training and validation: 1.2946 seconds Best estimated learner (returned model) is a multiclass svm model with: Coding (ECOC): onevsone BoxConstraint: 912.11 KernelScale: 13.622 Estimated validation loss: 0.24168 Estimated time for training and validation: 1.1953 seconds Documentation for fitcauto display ```

The final model returned by `fitcauto` corresponds to the best estimated learner. Before returning the model, the function retrains it using the entire training data (`creditTrain`), the listed `Learner` (or model) type, and the displayed hyperparameter values.

Evaluate Test Set Performance

The model `Mdl` corresponds to the best point in the Bayesian optimization according to the `"min-visited-mean"` criterion. To gauge how the model will perform on new data, look at the observed cross-validation accuracy of the model (`cvAccuracy`) and its general estimated performance based on the Bayesian optimization (`estimatedAccuracy`).

```[x,~,iteration] = bestPoint(Results,"Criterion","min-visited-mean"); cvError = Results.ObjectiveTrace(iteration); cvAccuracy = 1 - cvError```
```cvAccuracy = 0.7598 ```
```estimatedError = predictObjective(Results,x); estimatedAccuracy = 1 - estimatedError```
```estimatedAccuracy = 0.7583 ```

Evaluate the performance of the model on the test set. Create a confusion matrix from the results, and specify the order of the classes in the confusion matrix.

`testAccuracy = 1 - loss(Mdl,creditTest,"Rating")`
```testAccuracy = 0.7438 ```
```cm = confusionchart(creditTest.Rating,predict(Mdl,creditTest)); sortClasses(cm,["AAA","AA","A","BBB","BB","B","CCC"])```

## Input Arguments

collapse all

Sample data, specified as a table. Each row of `Tbl` corresponds to one observation, and each column corresponds to one predictor. Optionally, `Tbl` can contain one additional column for the response variable. Multicolumn variables and cell arrays other than cell arrays of character vectors are not accepted.

If `Tbl` contains the response variable, and you want to use all remaining variables in `Tbl` as predictors, specify the response variable using `ResponseVarName`.

If `Tbl` contains the response variable, and you want to use only a subset of the remaining variables in `Tbl` as predictors, specify a formula using `formula`.

If `Tbl` does not contain the response variable, specify a response variable using `Y`. The length of the response variable and the number of rows in `Tbl` must be equal.

Data Types: `table`

Response variable name, specified as the name of a variable in `Tbl`.

You must specify `ResponseVarName` as a character vector or string scalar. For example, if the response variable `Y` is stored as `Tbl.Y`, then specify it as `"Y"`. Otherwise, the software treats all columns of `Tbl`, including `Y`, as predictors when training the model.

The response variable must be a categorical, character, or string array; a logical or numeric vector; or a cell array of character vectors. If `Y` is a character array, then each element of the response variable must correspond to one row of the array.

A good practice is to specify the order of the classes by using the `ClassNames` name-value argument.

Data Types: `char` | `string`

Explanatory model of the response variable and a subset of the predictor variables, specified as a character vector or string scalar in the form `"Y~x1+x2+x3"`. In this form, `Y` represents the response variable, and `x1`, `x2`, and `x3` represent the predictor variables.

To specify a subset of variables in `Tbl` as predictors for training the model, use a formula. If you specify a formula, then the software does not use any variables in `Tbl` that do not appear in `formula`.

The variable names in the formula must be both variable names in `Tbl` (`Tbl.Properties.VariableNames`) and valid MATLAB® identifiers. You can verify the variable names in `Tbl` by using the `isvarname` function. If the variable names are not valid, then you can convert them by using the `matlab.lang.makeValidName` function.

Data Types: `char` | `string`

Class labels, specified as a numeric, categorical, or logical vector, a character or string array, or a cell array of character vectors.

• If `Y` is a character array, then each element of the class labels must correspond to one row of the array.

• The length of `Y` must be equal to the number of rows in `Tbl` or `X`.

• A good practice is to specify the class order by using the `ClassNames` name-value argument.

Data Types: `single` | `double` | `categorical` | `logical` | `char` | `string` | `cell`

Predictor data, specified as a numeric matrix.

Each row of `X` corresponds to one observation, and each column corresponds to one predictor.

The length of `Y` and the number of rows in `X` must be equal.

To specify the names of the predictors in the order of their appearance in `X`, use the `PredictorNames` name-value argument.

Data Types: `single` | `double`

Note

The software treats `NaN`, empty character vector (`''`), empty string (`""`), `<missing>`, and `<undefined>` elements as missing data. The software removes rows of data corresponding to missing values in the response variable. However, the treatment of missing values in the predictor data `X` or `Tbl` varies among models (or learners).

### Name-Value Arguments

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside quotes. You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `"HyperparameterOptimizationOptions",struct("MaxObjectiveEvaluations",200,"Verbose",2)` specifies to run 200 iterations of the optimization process (that is, try 200 model hyperparameter combinations), and to display information in the Command Window about the next model hyperparameter combination to be evaluated.
Optimization Options

collapse all

Types of classification models to try during the optimization, specified as a value in the first table below or one or more learner names in the second table. Specify multiple learner names as a string or cell array.

ValueDescription
`"auto"``fitcauto` automatically selects a subset of learners, suitable for the given predictor and response data. The learners can have model hyperparameter values that differ from the default. For more information, see Automatic Selection of Learners.
`"all"``fitcauto` selects all possible learners.
`"all-linear"``fitcauto` selects linear learners: `"discr"` (with a linear discriminant type) and `"linear"`.
`"all-nonlinear"``fitcauto` selects all nonlinear learners: `"discr"` (with a quadratic discriminant type), `"ensemble"`, `"kernel"`, `"knn"`, `"nb"`, `"svm"` (with a Gaussian or polynomial kernel), and `"tree"`.

Note

For greater efficiency, `fitcauto` does not select the following combinations of models when you specify one of the previous values.

• `"kernel"` and `"svm"` (with a Gaussian kernel) — `fitcauto` chooses the first when the predictor data has more than 11,000 observations, and the second otherwise.

• `"linear"` and `"svm"` (with a linear kernel) — `fitcauto` chooses the first.

Learner NameDescription
`"discr"`Discriminant analysis classifier
`"ensemble"`Ensemble classification model
`"kernel"`Kernel classification model
`"knn"`k-nearest neighbor model
`"linear"`Linear classification model
`"nb"`Naive Bayes classifier
`"svm"`Support vector machine classifier
`"tree"`Binary decision classification tree

Example: `"Learners","all"`

Example: `"Learners","ensemble"`

Example: `"Learners",["svm","tree"]`

Data Types: `char` | `string` | `cell`

Hyperparameters to optimize, specified as `"auto"` or `"all"`. The optimizable hyperparameters depend on the model (or learner), as described in this table.

Learner NameHyperparameters for `"auto"`Additional Hyperparameters for `"all"`Notes
`"discr"``Delta`, `Gamma``DiscrimType`

• When the `Learners` value is `"all-linear"`, the `fitcauto` function chooses among the `DiscrimType` values of `"linear"`, `"diaglinear"`, and `"pseudolinear"`, regardless of the `OptimizeHyperparameters` value.

• When the `Learners` value is `"all-nonlinear"`, the `fitcauto` function chooses among the `DiscrimType` values of `"quadratic"`, `"diagquadratic"`, and `"pseudoquadratic"`, regardless of the `OptimizeHyperparameters` value.

For more information, including hyperparameter search ranges, see `OptimizeHyperparameters`. Note that you cannot change hyperparameter search ranges when you use `fitcauto`.

`"ensemble"``Method`, `NumLearningCycles`, `LearnRate`, `MinLeafSize``MaxNumSplits`, `NumVariablesToSample`, `SplitCriterion`

When the ensemble `Method` value is a boosting method, the ensemble `NumBins` value is `50`.

For more information, including hyperparameter search ranges, see `OptimizeHyperparameters`. Note that you cannot change hyperparameter search ranges when you use `fitcauto`.

`"kernel"``KernelScale`, `Lambda`, `Coding` (for three or more classes only)`Learner`, `NumExpansionDimensions`For more information, including hyperparameter search ranges, see `OptimizeHyperparameters` and `OptimizeHyperparameters` (for three or more classes only). Note that you cannot change hyperparameter search ranges when you use `fitcauto`.
`"knn"``Distance`, `NumNeighbors``DistanceWeight`, `Exponent`, `Standardize`For more information, including hyperparameter search ranges, see `OptimizeHyperparameters`. Note that you cannot change hyperparameter search ranges when you use `fitcauto`.
`"linear"``Lambda`, `Learner`, `Coding` (for three or more classes only)`Regularization`For more information, including hyperparameter search ranges, see `OptimizeHyperparameters` and `OptimizeHyperparameters` (for three or more classes only). Note that you cannot change hyperparameter search ranges when you use `fitcauto`.
`"nb"``DistributionNames`, `Width``Kernel`For more information, including hyperparameter search ranges, see `OptimizeHyperparameters`. Note that you cannot change hyperparameter search ranges when you use `fitcauto`.
`"svm"``BoxConstraint`, `KernelScale`, `Coding` (for three or more classes only)`KernelFunction`, `PolynomialOrder`, `Standardize`

• When the `Learners` value is `"all-linear"`, the `fitcauto` function does not optimize the `KernelFunction` or `PolynomialOrder` hyperparameters when the `OptimizeHyperparameters` value is `"all"`.

• When the `Learners` value is `"all-nonlinear"`, the `fitcauto` function chooses among the `KernelFunction` values of `"gaussian"` and `"polynomial"`, regardless of the `OptimizeHyperparameters` value.

For more information, including hyperparameter search ranges, see `OptimizeHyperparameters` and `OptimizeHyperparameters` (for three or more classes only). Note that you cannot change hyperparameter search ranges when you use `fitcauto`.

`"tree"``MinLeafSize``MaxNumSplits`, `SplitCriterion`For more information, including hyperparameter search ranges, see `OptimizeHyperparameters`. Note that you cannot change hyperparameter search ranges when you use `fitcauto`.

Note

When `Learners` is set to a value other than `"auto"`, the default values for the model hyperparameters not being optimized match the default fit function values, unless otherwise indicated in the table notes. When `Learners` is set to `"auto"`, the optimized hyperparameter search ranges and nonoptimized hyperparameter values can vary, depending on the characteristics of the training data. For more information, see Automatic Selection of Learners.

Example: `"OptimizeHyperparameters","all"`

Options for the optimization, specified as a structure. All fields in the structure are optional.

Field NameValuesDefault
`Optimizer`
• `"bayesopt"` — Uses Bayesian optimization. For more details, see Bayesian Optimization.

• `"asha"` — Uses ASHA optimization. For more details, see ASHA Optimization.

`"bayesopt"`
`MaxObjectiveEvaluations`Maximum number of iterations (objective function evaluations), specified as a positive integer

`30*L`, where `L` is the number of learners (see `Learners`)

• This value is the default when the `Optimizer` field is set to `"bayesopt"`.

• For the default value when the `Optimizer` field is set to `"asha"`, see Number of ASHA Iterations.

`MaxTime`

Time limit, specified as a positive real number. The time limit is in seconds, as measured by `tic` and `toc`. Run time can exceed `MaxTime` because `MaxTime` does not interrupt function evaluations.

`Inf`
`ShowPlots`Logical value indicating whether to show a plot of the optimization progress. If `true`, this field plots the observed minimum validation loss against the iteration number. When you use Bayesian optimization, the plot also shows the estimated minimum validation loss.`true`
`SaveIntermediateResults`Logical value indicating whether to save results. If `true`, this field overwrites a workspace variable at each iteration. The variable is a `BayesianOptimization` object named `BayesoptResults` if you use Bayesian optimization, and a table named `ASHAResults` if you use ASHA optimization.`false`
`Verbose`

Display at the command line:

• `0` — No iterative display

• `1` — Iterative display

• `2` — Iterative display with additional information about the next point to be evaluated

`1`
`UseParallel`Logical value indicating whether to run the optimization in parallel, which requires Parallel Computing Toolbox™. Due to the nonreproducibility of parallel timing, parallel optimization does not necessarily yield reproducible results.`false`
`Repartition`

Logical value indicating whether to repartition the cross-validation at every iteration. If `false`, the optimizer uses a single partition for the optimization.

`true` usually gives the most robust results because this setting takes partitioning noise into account. However, for good results, `true` requires at least twice as many function evaluations.

`false`
`MaxTrainingSetSize`

Maximum number of observations in each training set, specified as a positive integer. This value matches the largest training set size.

Note

If you want to specify this value, the `Optimizer` field must be set to `"asha"`.

Largest available training partition size

• When the optimization uses `k`-fold cross-validation, this value is `(k – 1)*n/k`, where `n` is the total number of observations.

• When the optimization uses a `cvpartition` object `cvp`, this value is `max(cvp.TrainSize)`.

• When the optimization uses a holdout fraction `p`, this value is `(1 – p)*n`, where `n` is the total number of observations.

`MinTrainingSetSize`

Minimum number of observations in each training set, specified as a positive integer. This value is a lower bound for the smallest training set size.

Note

If you want to specify this value, the `Optimizer` field must be set to `"asha"`.

`100`
Specify only one of the following three options.
`CVPartition``cvpartition` object, created by `cvpartition``"Kfold",5` if you do not specify any cross-validation field
`Holdout`Scalar in the range `(0,1)` representing the holdout fraction
`Kfold`Integer greater than 1

Example: `"HyperparameterOptimizationOptions",struct("UseParallel",true)`

Data Types: `struct`

Classification Options

collapse all

Categorical predictors list, specified as one of the values in this table.

ValueDescription
Vector of positive integers

Each entry in the vector is an index value indicating that the corresponding predictor is categorical. The index values are between 1 and `p`, where `p` is the number of predictors used to train the model.

If `fitcauto` uses a subset of input variables as predictors, then the function indexes the predictors using only the subset. The `CategoricalPredictors` values do not count the response variable, observation weight variable, or any other variables that the function does not use.

Logical vector

A `true` entry means that the corresponding predictor is categorical. The length of the vector is `p`.

Character matrixEach row of the matrix is the name of a predictor variable. The names must match the entries in `PredictorNames`. Pad the names with extra blanks so each row of the character matrix has the same length.
String array or cell array of character vectorsEach element in the array is the name of a predictor variable. The names must match the entries in `PredictorNames`.
`"all"`All predictors are categorical.

By default, if the predictor data is in a table (`Tbl`), `fitcauto` assumes that a variable is categorical if it is a logical vector, categorical vector, character array, string array, or cell array of character vectors. However, learners that use decision trees assume that mathematically ordered categorical vectors are continuous variables. If the predictor data is a matrix (`X`), `fitcauto` assumes that all predictors are continuous. To identify any other predictors as categorical predictors, specify them by using the `CategoricalPredictors` name-value argument.

For more information on how fitting functions treat categorical predictors, see Automatic Creation of Dummy Variables.

Note

• `fitcauto` does not support categorical predictors for discriminant analysis classifiers. That is, if you want `Learners` to include `"discr"` models, you cannot specify the `CategoricalPredictors` name-value argument or use a table of sample data (`Tbl`) containing categorical predictors.

• `fitcauto` does not support a mix of numeric and categorical predictors for k-nearest neighbor models. That is, if you want `Learners` to include `"knn"` models, you must specify the `CategoricalPredictors` value as `"all"` or `[]`.

Example: `"CategoricalPredictors","all"`

Data Types: `single` | `double` | `logical` | `char` | `string` | `cell`

Names of classes to use for training, specified as a categorical, character, or string array; a logical or numeric vector; or a cell array of character vectors. `ClassNames` must have the same data type as the response variable in `Tbl` or `Y`.

If `ClassNames` is a character array, then each element must correspond to one row of the array.

Use `ClassNames` to:

• Specify the order of the classes during training.

• Specify the order of any input or output argument dimension that corresponds to the class order. For example, use `ClassNames` to specify the order of the dimensions of `Cost` or the column order of classification scores returned by `predict`.

• Select a subset of classes for training. For example, suppose that the set of all distinct class names in `Y` is `["a","b","c"]`. To train the model using observations from classes `"a"` and `"c"` only, specify `"ClassNames",["a","c"]`.

The default value for `ClassNames` is the set of all distinct class names in the response variable in `Tbl` or `Y`.

Example: `"ClassNames",["b","g"]`

Data Types: `categorical` | `char` | `string` | `logical` | `single` | `double` | `cell`

Misclassification cost, specified as a square matrix or structure array.

• If you specify a square matrix `Cost` and the true class of an observation is `i`, then `Cost(i,j)` is the cost of classifying a point into class `j`. That is, rows correspond to the true classes and columns correspond to the predicted classes. To specify the class order for the corresponding rows and columns of `Cost`, also specify the `ClassNames` name-value argument.

• If you specify a structure `S`, then it must have two fields:

• `S.ClassNames`, which contains the class names as a variable of the same data type as `Y`

• `S.ClassificationCosts`, which contains the cost matrix with rows and columns ordered as in `S.ClassNames`

Misclassification costs are used differently by the various models in `Learners`. However, `fitcauto` computes the same mean misclassification cost to compare the models during the optimization process. For more information, see Mean Misclassification Cost.

The default value for `Cost` is ```ones(K) – eye(K)```, where `K` is the number of distinct classes.

Example: `"Cost",[0 1; 2 0]`

Data Types: `single` | `double` | `struct`

Predictor variable names, specified as a string array of unique names or cell array of unique character vectors. The functionality of `PredictorNames` depends on the way you supply the training data.

• If you supply `X` and `Y`, then you can use `PredictorNames` to assign names to the predictor variables in `X`.

• The order of the names in `PredictorNames` must correspond to the column order of `X`. That is, `PredictorNames{1}` is the name of `X(:,1)`, `PredictorNames{2}` is the name of `X(:,2)`, and so on. Also, `size(X,2)` and `numel(PredictorNames)` must be equal.

• By default, `PredictorNames` is `{'x1','x2',...}`.

• If you supply `Tbl`, then you can use `PredictorNames` to choose which predictor variables to use in training. That is, `fitcauto` uses only the predictor variables in `PredictorNames` and the response variable during training.

• `PredictorNames` must be a subset of `Tbl.Properties.VariableNames` and cannot include the name of the response variable.

• By default, `PredictorNames` contains the names of all predictor variables.

• A good practice is to specify the predictors for training using either `PredictorNames` or `formula`, but not both.

Example: `"PredictorNames",["SepalLength","SepalWidth","PetalLength","PetalWidth"]`

Data Types: `string` | `cell`

Prior probabilities for each class, specified as a value in this table.

ValueDescription
`"empirical"`The class prior probabilities are the class relative frequencies in `Y`.
`"uniform"`All class prior probabilities are equal to 1/K, where K is the number of classes.
numeric vectorEach element is a class prior probability. Order the elements according to `Mdl``.ClassNames` or specify the order using the `ClassNames` name-value argument. The software normalizes the elements to sum to `1`.
structure

A structure `S` with two fields:

• `S.ClassNames` contains the class names as a variable of the same type as `Y`.

• `S.ClassProbs` contains a vector of corresponding prior probabilities. The software normalizes the elements to sum to `1`.

Example: `"Prior",struct("ClassNames",["b","g"],"ClassProbs",1:2)`

Data Types: `single` | `double` | `char` | `string` | `struct`

Response variable name, specified as a character vector or string scalar.

Example: `"ResponseName","response"`

Data Types: `char` | `string`

Score transformation, specified as a character vector, string scalar, or function handle.

This table summarizes the available character vectors and string scalars.

ValueDescription
`"doublelogit"`1/(1 + e–2x)
`"invlogit"`log(x / (1 – x))
`"ismax"`Sets the score for the class with the largest score to 1, and sets the scores for all other classes to 0
`"logit"`1/(1 + ex)
`"none"` or `"identity"`x (no transformation)
`"sign"`–1 for x < 0
0 for x = 0
1 for x > 0
`"symmetric"`2x – 1
`"symmetricismax"`Sets the score for the class with the largest score to 1, and sets the scores for all other classes to –1
`"symmetriclogit"`2/(1 + ex) – 1

For a MATLAB function or a function you define, use its function handle for the score transform. The function handle must accept a matrix (the original scores) and return a matrix of the same size (the transformed scores).

Example: `"ScoreTransform","logit"`

Data Types: `char` | `string` | `function_handle`

Observation weights, specified as a positive numeric vector or the name of a variable in `Tbl`. The software weights each observation in `X` or `Tbl` with the corresponding value in `Weights`. The length of `Weights` must equal the number of rows in `X` or `Tbl`.

If you specify the input data as a table `Tbl`, then `Weights` can be the name of a variable in `Tbl` that contains a numeric vector. In this case, you must specify `Weights` as a character vector or string scalar. For example, if the weights vector `W` is stored as `Tbl.W`, then specify it as `"W"`. Otherwise, the software treats all columns of `Tbl`, including `W`, as predictors or the response variable when training the model.

By default, `Weights` is `ones(n,1)`, where `n` is the number of observations in `X` or `Tbl`.

The software normalizes `Weights` to sum to the value of the prior probability in the respective class.

Data Types: `single` | `double` | `char` | `string`

## Output Arguments

collapse all

Trained classification model, returned as one of the classification model objects in this table.

Learner NameReturned Model Object
`"discr"``CompactClassificationDiscriminant`
`"ensemble"``CompactClassificationEnsemble`
`"kernel"`
`"knn"``ClassificationKNN`
`"linear"`
`"nb"``CompactClassificationNaiveBayes`
`"svm"`
`"tree"``CompactClassificationTree`

Optimization results, returned as a `BayesianOptimization` object if you use Bayesian optimization or a table if you use ASHA optimization. For more information, see Bayesian Optimization and ASHA Optimization.

collapse all

### Verbose Display

When you set the `Verbose` field of the `HyperparameterOptimizationOptions` name-value argument to `1` or `2`, the `fitcauto` function provides an iterative display of the optimization results.

The following table describes the columns in the display and their entries.

Column NameDescription
`Iter`Iteration number — You can set a limit to the number of iterations by using the `MaxObjectiveEvaluations` field of the `HyperparameterOptimizationOptions` name-value argument.
`Active workers`Number of active parallel workers — This column appears only when you run the optimization in parallel by setting the `UseParallel` field of the `HyperparameterOptimizationOptions` name-value argument to `true`.
`Eval result`

One of the following evaluation results:

• `Best` — The learner and hyperparameter values at this iteration give the minimum observed validation loss computed so far. That is, the `Validation loss` value is the smallest computed so far.

• `Accept` — The learner and hyperparameter values at this iteration give meaningful (for example, non-`NaN`) validation loss values.

• `Error` — The learner and hyperparameter values at this iteration result in an error (for example, a ```Validation loss``` value of `NaN`).

`Validation loss`

Validation loss computed for the learner and hyperparameter values at this iteration — In particular, `fitcauto` computes the cross-validation classification error by default. If you specify misclassification costs by using the `Cost` name-value argument, `fitcauto` computes the mean misclassification cost instead. For more information, see Mean Misclassification Cost.

You can change the validation scheme by using the `CVPartition`, `Holdout`, or `Kfold` field of the `HyperparameterOptimizationOptions` name-value argument.

`Time for training & validation (sec)`Time taken to train and compute the validation loss for the model with the learner and hyperparameter values at this iteration (in seconds) — When you use Bayesian optimization, this value excludes the time required to update the objective function model maintained by the Bayesian optimization process. For more details, see Bayesian Optimization.
`Observed min validation loss`

Observed minimum validation loss computed so far — This value corresponds to the smallest `Validation loss` value computed so far in the optimization process.

By default, `fitcauto` returns a plot of the optimization that displays dark blue points for the observed minimum validation loss values. This plot does not appear when the `ShowPlots` field of the `HyperparameterOptimizationOptions` name-value argument is set to `false`.

`Estimated min validation loss`

Estimated minimum validation loss — When you use Bayesian optimization, `fitcauto` updates, at each iteration, an objective function model maintained by the Bayesian optimization process, and uses this model to estimate the minimum validation loss. For more details, see Bayesian Optimization.

By default, `fitcauto` returns a plot of the optimization that displays light blue points for the estimated minimum validation loss values. This plot does not appear when the `ShowPlots` field of the `HyperparameterOptimizationOptions` name-value argument is set to `false`.

Note

This column appears only when you use Bayesian optimization, that is, when the `Optimizer` field of the `HyperparameterOptimizationOptions` name-value argument is set to `"bayesopt"`.

`Training set size`

Number of observations used in each training set at this iteration — Use the `MaxTrainingSetSize` and `MinTrainingSetSize` fields of the `HyperparameterOptimizationOptions` name-value argument to specify bounds for the training set size. For more details, see ASHA Optimization.

Note

This column appears only when you use ASHA optimization, that is, when the `Optimizer` field of the `HyperparameterOptimizationOptions` name-value argument is set to `"asha"`.

`Learner`Model type evaluated at this iteration — Specify the learners used in the optimization by using the `Learners` name-value argument.
`Hyperparameter: Value`Hyperparameter values at this iteration — Specify the hyperparameters used in the optimization by using the `OptimizeHyperparameters` name-value argument.

The display also includes these model descriptions:

• `Best observed learner` — This model, with the listed learner type and hyperparameter values, yields the final observed minimum validation loss. When you use ASHA optimization, `fitcauto` retrains the model on the entire training data set and returns it as the `Mdl` output.

• `Best estimated learner` — This model, with the listed learner type and hyperparameter values, yields the final estimated minimum validation loss when you use Bayesian optimization. In this case, `fitcauto` retrains the model on the entire training data set and returns it as the `Mdl` output.

Note

The `Best estimated learner` model appears only when you use Bayesian optimization, that is, when the `Optimizer` field of the `HyperparameterOptimizationOptions` name-value argument is set to `"bayesopt"`.

## Tips

• Depending on the size of your data set, the number of learners you specify, and the optimization method you choose, `fitcauto` can take some time to run.

• If you have a Parallel Computing Toolbox license, you can speed up computations by running the optimization in parallel. To do so, specify `"HyperparameterOptimizationOptions",struct("UseParallel",true)`. You can include additional fields in the structure to control other aspects of the optimization. See `HyperparameterOptimizationOptions`.

• If `fitcauto` with Bayesian optimization takes a long time to run because of the number of observations in your training set (for example, over 10,000), consider using `fitcauto` with ASHA optimization instead. ASHA optimization often finds good solutions faster than Bayesian optimization for data sets with many observations. To use ASHA optimization, specify `"HyperparameterOptimizationOptions",struct("Optimizer","asha")`. You can include additional fields in the structure to control other aspects of the optimization. In particular, if you have a time constraint, specify the `MaxTime` field of the `HyperparameterOptimizationOptions` structure to limit the number of seconds `fitcauto` runs.

## Algorithms

collapse all

### Automatic Selection of Learners

When you specify `"Learners","auto"`, the `fitcauto` function analyzes the predictor and response data in order to choose appropriate learners. The function considers whether the data set has any of these characteristics:

• Categorical predictors

• Missing values for more than 5% of the data

• Imbalanced data, where the ratio of the number of observations in the largest class to the number of observations in the smallest class is greater than 5

• More than 100 observations in the smallest class

• Wide data, where the number of predictors is greater than or equal to the number of observations

• High-dimensional data, where the number of predictors is greater than 100

• Large data, where the number of observations is greater than 50,000

• Binary response variable

• Ordinal response variable

The selected learners are always a subset of those listed in the `Learners` table. However, the associated models tried during the optimization process can have different default values for hyperparameters not being optimized, as well as different search ranges for hyperparameters being optimized.

### Bayesian Optimization

The goal of Bayesian optimization, and optimization in general, is to find a point that minimizes an objective function. In the context of `fitcauto`, a point is a learner type together with a set of hyperparameter values for the learner (see `Learners` and `OptimizeHyperparameters`), and the objective function is the cross-validation classification error, by default. The Bayesian optimization implemented in `fitcauto` internally maintains a multi-`TreeBagger` model of the objective function. That is, the objective function model splits along the learner type and, for a given learner, the model is a `TreeBagger` ensemble for regression. (This underlying model differs from the Gaussian process model employed by other Statistics and Machine Learning Toolbox™ functions that use Bayesian optimization.) Bayesian optimization trains the underlying model by using objective function evaluations, and determines the next point to evaluate by using an acquisition function (`"expected-improvement"`). For more information, see Expected Improvement. The acquisition function balances between sampling at points with low modeled objective function values and exploring areas that are not well modeled yet. At the end of the optimization, `fitcauto` chooses the point with the minimum objective function model value, among the points evaluated during the optimization. For more information, see the `"Criterion","min-visited-mean"` name-value argument of `bestPoint`.

### ASHA Optimization

The asynchronous successive halving algorithm (ASHA) in `fitcauto` randomly chooses several models with different hyperparameter values (see `Learners` and `OptimizeHyperparameters`) and trains them on a small subset of the training data. If the performance of a particular model is promising, the model is promoted and trained on a larger amount of the training data. This process repeats, and successful models are trained on progressively larger amounts of data. By default, at the end of the optimization, `fitcauto` chooses the model that has the lowest cross-validation classification error.

At each iteration, ASHA either chooses a previously trained model and promotes it (that is, retrains the model using more training data), or selects a new model (learner type and hyperparameter values) using random search. ASHA promotes models as follows:

• The algorithm searches for the group of models with the largest training set size for which this condition does not hold: `floor(g/4)` of the models have been promoted, where `g` is the number of models in the group.

• Among the group of models, ASHA chooses the model with the lowest cross-validation classification error and retrains that model with ```4*(Training Set Size)``` observations.

• If no such group of models exists, then ASHA selects a new model instead of promoting an old one, and trains the new model using the smallest training set size.

When a model is trained on a subset of the training data, ASHA computes the cross-validation classification error as follows:

• For each training fold, the algorithm selects a random sample of the observations (of size `Training set size`) using stratified sampling, and then trains a model on that subset of data.

• The algorithm then tests the fitted model on the test fold (that is, the observations not in the training fold) and computes the classification error.

• Finally, the algorithm averages the results across all folds.

### Number of ASHA Iterations

When you use ASHA optimization, the default number of iterations depends on the number of observations in the data, the number of learner types, the use of parallel processing, and the type of cross-validation. The algorithm selects the number of iterations such that, for L learner types (see `Learners`), `fitcauto` trains L models on the largest training set size.

This table describes the default number of iterations based on the given specifications when you use 5-fold cross-validation. Note that n represents the number of observations and L represents the number of learner types.

Number of Observations

n

Default Number of Iterations

(run in serial)

Default Number of Iterations

(run in parallel)

n < 50030*Ln is too small to implement ASHA optimization, and `fitcauto` implements random search to find and assess models instead.30*Ln is too small to implement ASHA optimization, and `fitcauto` implements random search to find and assess models instead.
500 ≤ n < 20005*L5*(L + 1)
2000 ≤ n < 800021*L21*(L + 1)
8000 ≤ n < 32,00085*L85*(L + 1)
32,000 ≤ n341*L341*(L + 1)

### Mean Misclassification Cost

If you specify the `Cost` name-value argument, then `fitcauto` minimizes the mean misclassification cost rather than the misclassification error as part of the optimization process. The mean misclassification cost is defined as

`$L=\frac{\sum _{j=1}^{n}C\left({k}_{j},{\stackrel{^}{k}}_{j}\right)\cdot I\left({y}_{j}\ne {\stackrel{^}{y}}_{j}\right)}{n}$`

where

• C is the misclassification cost matrix as specified by the `Cost` name-value argument, and I is the indicator function.

• yj is the true class label for observation j, and yj belongs to class kj.

• ${\stackrel{^}{y}}_{j}$ is the class label with the maximal predicted score for observation j, and ${\stackrel{^}{y}}_{j}$ belongs to class ${\stackrel{^}{k}}_{j}$.

• n is the number of observations in the validation set.

## Alternative Functionality

• If you are unsure which models work best for your data set, you can alternatively use the Classification Learner app. Using the app, you can perform hyperparameter tuning for different models, and choose the optimized model that performs best. Although you must select a specific model before you can tune the model hyperparameters, Classification Learner provides greater flexibility for selecting optimizable hyperparameters and setting hyperparameter values. However, you cannot optimize in parallel, optimize `"linear"` or `"kernel"` learners, specify observation weights, specify prior probabilities, or use ASHA optimization in the app. For more information, see Hyperparameter Optimization in Classification Learner App.

• If you know which models might suit your data, you can alternatively use the corresponding model fit functions and specify the `OptimizeHyperparameters` name-value argument to tune hyperparameters. You can compare the results across the models to select the best classifier. For an example of this process, see Moving Towards Automating Model Selection Using Bayesian Optimization.

## References

[1] Li, Liam, Kevin Jamieson, Afshin Rostamizadeh, Ekaterina Gonina, Moritz Hardt, Benjamin Recht, and Ameet Talwalkar. “A System for Massively Parallel Hyperparameter Tuning.” ArXiv:1810.05934v5 [Cs], March 16, 2020. https://arxiv.org/abs/1810.05934v5.