Skip to main content

Hyperparameter Tuning Example

Layer provides a declarative way of Hyperparameter Tuning. In this example, we will tune the parameters of Titanic Survival Model to find the best configuration. We will see how we can use different search algorithms: Random, Bayesian, Manual and Grid.

In this project, you will find the same dataset and featuresets we have developed for the Titanic Survival Model but also four different models each tuned with different search algorithms.

What we are going to learn?#

  • Hyperparameter tuning with four different search algorithms:
    • Bayesian
    • Random
    • Grid
    • Manual

Installation & Running#

To check out the Hyperparameter Tuning example, run:

layer clone https://github.com/layerml/examples
cd examples/titanic-hyperparametertuning

To build the project:

layer start

File Structure#

.
├── .layer
├── data
│ ├── passenger_features # feature definitions
│ │ ├── ageband.sql # Age Band of the passenger
│ │ ├── embarked.sql # Embarked or not
│ │ ├── fareband.sql # Fare Band of the passenger
│ │ ├── is_alone.sql # Is Passenger travelling alone
│ │ ├── sex.sql # Sex of the passenger
│ │ ├── survived.sql # Survived or not
│ │ ├── title.sql # Title of the passenger
│ │ └── dataset.yml # Declares the metadata of the features above
│ └── titanic_data
│ └── dataset.yml # Declares where our source `titanic` dataset is
├── models
│ ├── survival_model_bayesian_search
│ │ ├── model.yml # Training and Bayesian tuning directives of our model
│ │ ├── model.py # Source code of the `Survival` model
│ │ └── requirements.txt # Environment config file
│ ├── survival_model_grid_search
│ │ ├── model.yml # Training and Grid tuning directives of our model
│ │ ├── model.py # Source code of the `Survival` model
│ │ └── requirements.txt # Environment config file
│ ├── survival_model_manual_search
│ │ ├── model.yml # Training and Manual tuning directives of our model
│ │ ├── model.py # Source code of the `Survival` model
│ │ └── requirements.txt # Environment config file
│ └── survival_model_random_search
│ ├── model.yml # Training and Random tuning directives of our model
│ ├── model.py # Source code of the `Survival` model
│ └── requirements.txt # Environment config file
└── README.md