(Advanced) Use Job Submission to Tune Hyperparameters
Last updated
Last updated
For typical machine learning algorithms, there are many hyperparameters to tune. Finding the right hyperparameters can be a very time consuming job. However, with Job Submission, you can let it run the job for you. All you have to do is simply check the results when the job is complete.
Let's create another Python file tune_dropout.py
in JupyterLab first:
The main difference from the last version is that we are now output testing dataset's accuracy into a text file.
Please note: we are not splitting dataset into training, validation, testing sub-datasets. For convenience, we are only using this dataset to tune the hyperparameters.
Select the Job Submission tab again and select same group, instance type and image. But this time, type the following command; replace <group name>
:
Here we write shell script loops through a 0.1 to 0.9 dropout rate. At the end of this command, the best accuracy and dropout rate is printed out.
If you prefer, rather than writing in a shell script, you can create another Python file and wrap the original code as a function and write a for loop
in Python. We can submit this new Python file as a job to find out best dropout rate.
After your job has succeeded, you can view the best dropout rate for your model.
Your results may not match this image below
In the future, we will provide even better hyperparameters tuning functions. Stay tuned!