from azureml.core import Experiment, ScriptRunConfig, Environment from azureml.core.conda_dependencies import CondaDependencies from azureml.train.hyperdrive import GridParameterSampling, HyperDriveConfig, PrimaryMetricGoal, choice from azureml.widgets import RunDetails # Sample a range of parameter values params = GridParameterSampling( { # Hyperdrive will try 6 combinations, adding these as script arguments '--learning_rate': choice(0.01, 0.1, 1.0), '--n_estimators' : choice(10, 100) } ) # Configure hyperdrive settings hyperdrive = HyperDriveConfig(run_config=script_config, hyperparameter_sampling=params, policy=None, # No early stopping policy primary_metric_name='AUC', # Find the highest AUC metric primary_metric_goal=PrimaryMetricGoal.MAXIMIZE, max_total_runs=6, # Restict the experiment to 6 iterations max_concurrent_runs=2) # Run up to 2 iterations in parallel # Run the experiment experiment = Experiment(workspace=ws, name='mslearn-diabetes-hyperdrive') run = experiment.submit(config=hyperdrive) # Show the status in the notebook as the experiment runs RunDetails(run).show() run.wait_for_completion()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter