GridParameterSampling Class

Defines grid sampling over a hyperparameter search space.

Initialize GridParameterSampling.

Inheritance
azureml.train.hyperdrive.sampling.HyperParameterSampling
GridParameterSampling

Constructor

GridParameterSampling(parameter_space, properties=None)

Parameters

Name Description
parameter_space
Required

A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter. Only choice is supported for GridParameter sampling.

parameter_space
Required

A dictionary containing each parameter and its distribution. The dictionary key is the name of the parameter. Only choice is supported for GridParameter sampling.

properties
Default value: None

Remarks

In this sampling algorithm, parameter values are chosen from discrete values. You can use the choice function to generate discrete values. For example:


   {
   "lr": choice(1, 2, 3),
   "batch": choice(8, 9)
   }

This will define a search space with two parameters, lr and batch. lr can have one of the values [1, 2, 3], and batch a value one of the values [8, 9].

You can also create discrete hyperparameters using a distribution. For more information, see the tutorial Tune hyperparameters for your model.

Attributes

SAMPLING_NAME

SAMPLING_NAME = 'GRID'