Last active
          November 30, 2022 09:38 
        
      - 
      
- 
        Save scottire/2395b306818f3e520b6725a69c0dd7e4 to your computer and use it in GitHub Desktop. 
    Get started tuning hyperparameters with W&B quickly 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import wandb | |
| # 1: Define objective/training function | |
| def objective(config): | |
| score = config.x ** 3 + config.y | |
| return score | |
| def main(): | |
| wandb.init(project='my-first-sweep') | |
| score = objective(wandb.config) | |
| wandb.log({'score': score}) | |
| # 2: Define the search space | |
| sweep_configuration = { | |
| 'method': 'random', | |
| 'metric': {'goal': 'minimize', 'name': 'score'}, | |
| 'parameters': | |
| { | |
| 'x': {'max': 0.1, 'min': 0.01}, | |
| 'y': {'values': [1, 3, 7]}, | |
| } | |
| } | |
| # 3: Start the sweep | |
| sweep_id = wandb.sweep(sweep=sweep_configuration, project='my-first-sweep') | |
| wandb.agent(sweep_id, function=main, count=10) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment