Skip to content

Commit 8edcae9

Browse files
Update README.md
1 parent 439159e commit 8edcae9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

README.md

+39
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,42 @@ PART 5 - MODEL TUNING
250250
- The hyperparameters of a machine learning model are parameters that are not learned from data.
251251
- They should be set prior to fitting the model to the training set.
252252

253+
Parameters
254+
- learned from data
255+
- CART example: split-point of a node, split-feature of a node, ...
256+
257+
Hyperparameters
258+
- not learned from data, set prior to training
259+
- CART example: max_depth , min_samples_leaf , splitting criterion ...
260+
261+
What is hyperparameter tuning?
262+
- Problem: search for a set of optimal hyperparameters for a learning algorithm.
263+
- Solution: find a set of optimal hyperparameters that results in an optimal model.
264+
- Optimal model: yields an optimal score.
265+
- Score: in sklearn defaults to accuracy (classication) and R-squared (regression).
266+
- Cross validation is used to estimate the generalization performance.
267+
268+
Why tune hyperparameters?
269+
- In sklearn, a model's default hyperparameters are not optimal for all problems.
270+
- Hyperparameters should be tuned to obtain the best model performance.
271+
272+
Approaches to hyperparameter tuning
273+
- Grid Search
274+
- Random Search
275+
- Bayesian Optimization
276+
- GeneticAlgorithms etc.
277+
278+
Grid search cross validation
279+
- Manually set a grid of discrete hyperparameter values.
280+
- Set a metric for scoring model performance.
281+
- Search exhaustively through the grid.
282+
- For each set of hyperparameters, evaluate each model's CV score.
283+
- The optimal hyperparameters are those ofthe model achieving the best CV score.
284+
285+
Grid search cross validation: example
286+
- Hyperparameters grids:
287+
- max_depth = {2,3,4},
288+
- min_samples_leaf = {0.05, 0.1}
289+
- hyperparameter space = { (2,0.05) , (2,0.1) , (3,0.05), ... }
290+
- CV scores = { score , ... }
291+
- optimal hyperparameters = set of hyperparameters corresponding to the best CV score.

0 commit comments

Comments
 (0)