Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Automatic Hyperparameter Tuning | Conclusion
Introduction to Neural Networks
course content

Contenu du cours

Introduction to Neural Networks

Introduction to Neural Networks

1. Concept of Neural Network
2. Neural Network from Scratch
3. Conclusion

book
Challenge: Automatic Hyperparameter Tuning

Rather than manually selecting specific values for our model's hyperparameters, randomized search (RandomizedSearchCV) offers a more efficient way to find an optimal configuration. Unlike grid search (GridSearchCV), which systematically evaluates all possible combinations of hyperparameters, randomized search selects a random subset of these combinations. This approach significantly reduces computational cost while still yielding strong results.

For neural networks, where the number of possible hyperparameter combinations can be immense, exhaustively testing every option is often impractical. Randomized search circumvents this issue by randomly sampling a defined number of hyperparameter sets, balancing exploration and efficiency.

  • estimator: the model to optimize (e.g., MLPClassifier);
  • param_distributions: a dictionary where keys are hyperparameter names and values are lists which to sample;
  • n_iter: specifies how many random combinations should be tested. A higher value increases the chances of finding an optimal combination but requires more computation;
  • scoring: defines the evaluation metric (e.g., 'accuracy' for classification).
Tâche

Swipe to start coding

  1. In param_distributions, generate values for two hidden layers, where each layer has the same number of neurons, ranging from 20 to 30 (exclusive) with a step of 2.
  2. In param_distributions, set the learning rate values to 0.02, 0.01, and 0.005.
  3. In param_distributions, generate 10 random values for the number of training epochs, ensuring they are within the range 10 to 50 (inclusive).
  4. Apply randomized search with 4 iterations (number of hyperparameter combinations to evaluate) and use accuracy as the evaluation metric.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3
toggle bottom row

book
Challenge: Automatic Hyperparameter Tuning

Rather than manually selecting specific values for our model's hyperparameters, randomized search (RandomizedSearchCV) offers a more efficient way to find an optimal configuration. Unlike grid search (GridSearchCV), which systematically evaluates all possible combinations of hyperparameters, randomized search selects a random subset of these combinations. This approach significantly reduces computational cost while still yielding strong results.

For neural networks, where the number of possible hyperparameter combinations can be immense, exhaustively testing every option is often impractical. Randomized search circumvents this issue by randomly sampling a defined number of hyperparameter sets, balancing exploration and efficiency.

  • estimator: the model to optimize (e.g., MLPClassifier);
  • param_distributions: a dictionary where keys are hyperparameter names and values are lists which to sample;
  • n_iter: specifies how many random combinations should be tested. A higher value increases the chances of finding an optimal combination but requires more computation;
  • scoring: defines the evaluation metric (e.g., 'accuracy' for classification).
Tâche

Swipe to start coding

  1. In param_distributions, generate values for two hidden layers, where each layer has the same number of neurons, ranging from 20 to 30 (exclusive) with a step of 2.
  2. In param_distributions, set the learning rate values to 0.02, 0.01, and 0.005.
  3. In param_distributions, generate 10 random values for the number of training epochs, ensuring they are within the range 10 to 50 (inclusive).
  4. Apply randomized search with 4 iterations (number of hyperparameter combinations to evaluate) and use accuracy as the evaluation metric.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 3
Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
We're sorry to hear that something went wrong. What happened?
some-alt