Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

grid_search.py 891 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  1. import itertools
  2. import subprocess
  3. # Automated grid search experiments
  4. n_estimators = [250, 500]
  5. max_depth = [3, 4]
  6. learning_rate = [0.1, 0.01]
  7. min_samples_split = [2, 4, 6]
  8. min_samples_leaf = [1, 3, 5]
  9. # Iterate over all combinations of hyper-parameter values.
  10. for n_est, m_depth, lr, min_split, min_leaf in itertools.product(n_estimators, max_depth, learning_rate, min_samples_split, min_samples_leaf):
  11. # Execute "dvc exp run --queue --set-param train.n_est=<n_est> --set-param train.min_split=<min_split>".
  12. subprocess.run(["dvc", "exp", "run", "--queue",
  13. "--set-param", f"training.n_est={n_est}",
  14. "--set-param", f"training.m_depth={m_depth}",
  15. "--set-param", f"training.lr={lr}",
  16. "--set-param", f"training.min_split={min_split}",
  17. "--set-param", f"training.min_leaf={min_leaf}"])
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...