Class ImageModelDistributionSettings
java.lang.Object
com.azure.resourcemanager.machinelearning.models.ImageModelDistributionSettings
- All Implemented Interfaces:
com.azure.json.JsonSerializable<ImageModelDistributionSettings>
- Direct Known Subclasses:
ImageModelDistributionSettingsClassification,ImageModelDistributionSettingsObjectDetection
public class ImageModelDistributionSettings
extends Object
implements com.azure.json.JsonSerializable<ImageModelDistributionSettings>
Distribution expressions to sweep over values of model settings.
<example>
Some examples are:
```
ModelName = "choice('seresnext', 'resnest50')";
LearningRate = "uniform(0.001, 0.01)";
LayersToFreeze = "choice(0, 2)";
```</example>
All distributions can be specified as distribution_name(min, max) or choice(val1, val2, ..., valn)
where distribution name can be: uniform, quniform, loguniform, etc
For more details on how to compose distribution expressions please check the documentation:
https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters
For more information on the available settings please visit the official documentation:
https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of ImageModelDistributionSettings class. -
Method Summary
Modifier and TypeMethodDescriptionGet the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.Get the augmentations property: Settings for using Augmentations.beta1()Get the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'.beta2()Get the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'.Get the distributed property: Whether to use distributer training.Get the earlyStopping property: Enable early stopping logic during training.Get the earlyStoppingDelay property: Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping.Get the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped.Get the enableOnnxNormalization property: Enable normalization when exporting ONNX model.Get the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores.fromJson(com.azure.json.JsonReader jsonReader) Reads an instance of ImageModelDistributionSettings from the JsonReader.Get the gradientAccumulationStep property: Gradient accumulation means running a configured number of "GradAccumulationStep" steps without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates.Get the layersToFreeze property: Number of layers to freeze for the model.Get the learningRate property: Initial learning rate.Get the learningRateScheduler property: Type of learning rate scheduler.Get the modelName property: Name of the model to use for training.momentum()Get the momentum property: Value of momentum when optimizer is 'sgd'.nesterov()Get the nesterov property: Enable nesterov when optimizer is 'sgd'.Get the numberOfEpochs property: Number of training epochs.Get the numberOfWorkers property: Number of data loader workers.Get the optimizer property: Type of optimizer.Get the randomSeed property: Random seed to be used when using deterministic training.Get the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'.Get the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Get the trainingBatchSize property: Training batch size.voidvalidate()Validates the instance.Get the validationBatchSize property: Validation batch size.Get the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'.Get the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'.Get the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'.withAmsGradient(String amsGradient) Set the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.withAugmentations(String augmentations) Set the augmentations property: Settings for using Augmentations.Set the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'.Set the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'.withDistributed(String distributed) Set the distributed property: Whether to use distributer training.withEarlyStopping(String earlyStopping) Set the earlyStopping property: Enable early stopping logic during training.withEarlyStoppingDelay(String earlyStoppingDelay) Set the earlyStoppingDelay property: Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping.withEarlyStoppingPatience(String earlyStoppingPatience) Set the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped.withEnableOnnxNormalization(String enableOnnxNormalization) Set the enableOnnxNormalization property: Enable normalization when exporting ONNX model.withEvaluationFrequency(String evaluationFrequency) Set the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores.withGradientAccumulationStep(String gradientAccumulationStep) Set the gradientAccumulationStep property: Gradient accumulation means running a configured number of "GradAccumulationStep" steps without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates.withLayersToFreeze(String layersToFreeze) Set the layersToFreeze property: Number of layers to freeze for the model.withLearningRate(String learningRate) Set the learningRate property: Initial learning rate.withLearningRateScheduler(String learningRateScheduler) Set the learningRateScheduler property: Type of learning rate scheduler.withModelName(String modelName) Set the modelName property: Name of the model to use for training.withMomentum(String momentum) Set the momentum property: Value of momentum when optimizer is 'sgd'.withNesterov(String nesterov) Set the nesterov property: Enable nesterov when optimizer is 'sgd'.withNumberOfEpochs(String numberOfEpochs) Set the numberOfEpochs property: Number of training epochs.withNumberOfWorkers(String numberOfWorkers) Set the numberOfWorkers property: Number of data loader workers.withOptimizer(String optimizer) Set the optimizer property: Type of optimizer.withRandomSeed(String randomSeed) Set the randomSeed property: Random seed to be used when using deterministic training.withStepLRGamma(String stepLRGamma) Set the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'.withStepLRStepSize(String stepLRStepSize) Set the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'.withTrainingBatchSize(String trainingBatchSize) Set the trainingBatchSize property: Training batch size.withValidationBatchSize(String validationBatchSize) Set the validationBatchSize property: Validation batch size.withWarmupCosineLRCycles(String warmupCosineLRCycles) Set the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'.withWarmupCosineLRWarmupEpochs(String warmupCosineLRWarmupEpochs) Set the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'.withWeightDecay(String weightDecay) Set the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
ImageModelDistributionSettings
public ImageModelDistributionSettings()Creates an instance of ImageModelDistributionSettings class.
-
-
Method Details
-
amsGradient
Get the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.- Returns:
- the amsGradient value.
-
withAmsGradient
Set the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.- Parameters:
amsGradient- the amsGradient value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
augmentations
Get the augmentations property: Settings for using Augmentations.- Returns:
- the augmentations value.
-
withAugmentations
Set the augmentations property: Settings for using Augmentations.- Parameters:
augmentations- the augmentations value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
beta1
Get the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].- Returns:
- the beta1 value.
-
withBeta1
Set the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].- Parameters:
beta1- the beta1 value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
beta2
Get the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].- Returns:
- the beta2 value.
-
withBeta2
Set the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].- Parameters:
beta2- the beta2 value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
distributed
Get the distributed property: Whether to use distributer training.- Returns:
- the distributed value.
-
withDistributed
Set the distributed property: Whether to use distributer training.- Parameters:
distributed- the distributed value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
earlyStopping
Get the earlyStopping property: Enable early stopping logic during training.- Returns:
- the earlyStopping value.
-
withEarlyStopping
Set the earlyStopping property: Enable early stopping logic during training.- Parameters:
earlyStopping- the earlyStopping value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
earlyStoppingDelay
Get the earlyStoppingDelay property: Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping. Must be a positive integer.- Returns:
- the earlyStoppingDelay value.
-
withEarlyStoppingDelay
Set the earlyStoppingDelay property: Minimum number of epochs or validation evaluations to wait before primary metric improvement is tracked for early stopping. Must be a positive integer.- Parameters:
earlyStoppingDelay- the earlyStoppingDelay value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
earlyStoppingPatience
Get the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped. Must be a positive integer.- Returns:
- the earlyStoppingPatience value.
-
withEarlyStoppingPatience
Set the earlyStoppingPatience property: Minimum number of epochs or validation evaluations with no primary metric improvement before the run is stopped. Must be a positive integer.- Parameters:
earlyStoppingPatience- the earlyStoppingPatience value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
evaluationFrequency
Get the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.- Returns:
- the evaluationFrequency value.
-
withEvaluationFrequency
Set the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.- Parameters:
evaluationFrequency- the evaluationFrequency value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
enableOnnxNormalization
Get the enableOnnxNormalization property: Enable normalization when exporting ONNX model.- Returns:
- the enableOnnxNormalization value.
-
withEnableOnnxNormalization
Set the enableOnnxNormalization property: Enable normalization when exporting ONNX model.- Parameters:
enableOnnxNormalization- the enableOnnxNormalization value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
gradientAccumulationStep
Get the gradientAccumulationStep property: Gradient accumulation means running a configured number of "GradAccumulationStep" steps without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates. Must be a positive integer.- Returns:
- the gradientAccumulationStep value.
-
withGradientAccumulationStep
Set the gradientAccumulationStep property: Gradient accumulation means running a configured number of "GradAccumulationStep" steps without updating the model weights while accumulating the gradients of those steps, and then using the accumulated gradients to compute the weight updates. Must be a positive integer.- Parameters:
gradientAccumulationStep- the gradientAccumulationStep value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
layersToFreeze
Get the layersToFreeze property: Number of layers to freeze for the model. Must be a positive integer. For instance, passing 2 as value for 'seresnext' means freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.- Returns:
- the layersToFreeze value.
-
withLayersToFreeze
Set the layersToFreeze property: Number of layers to freeze for the model. Must be a positive integer. For instance, passing 2 as value for 'seresnext' means freezing layer0 and layer1. For a full list of models supported and details on layer freeze, please see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.- Parameters:
layersToFreeze- the layersToFreeze value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
learningRate
Get the learningRate property: Initial learning rate. Must be a float in the range [0, 1].- Returns:
- the learningRate value.
-
withLearningRate
Set the learningRate property: Initial learning rate. Must be a float in the range [0, 1].- Parameters:
learningRate- the learningRate value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
learningRateScheduler
Get the learningRateScheduler property: Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.- Returns:
- the learningRateScheduler value.
-
withLearningRateScheduler
Set the learningRateScheduler property: Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.- Parameters:
learningRateScheduler- the learningRateScheduler value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
modelName
Get the modelName property: Name of the model to use for training. For more information on the available models please visit the official documentation: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.- Returns:
- the modelName value.
-
withModelName
Set the modelName property: Name of the model to use for training. For more information on the available models please visit the official documentation: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models.- Parameters:
modelName- the modelName value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
momentum
Get the momentum property: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].- Returns:
- the momentum value.
-
withMomentum
Set the momentum property: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].- Parameters:
momentum- the momentum value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
nesterov
Get the nesterov property: Enable nesterov when optimizer is 'sgd'.- Returns:
- the nesterov value.
-
withNesterov
Set the nesterov property: Enable nesterov when optimizer is 'sgd'.- Parameters:
nesterov- the nesterov value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
numberOfEpochs
Get the numberOfEpochs property: Number of training epochs. Must be a positive integer.- Returns:
- the numberOfEpochs value.
-
withNumberOfEpochs
Set the numberOfEpochs property: Number of training epochs. Must be a positive integer.- Parameters:
numberOfEpochs- the numberOfEpochs value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
numberOfWorkers
Get the numberOfWorkers property: Number of data loader workers. Must be a non-negative integer.- Returns:
- the numberOfWorkers value.
-
withNumberOfWorkers
Set the numberOfWorkers property: Number of data loader workers. Must be a non-negative integer.- Parameters:
numberOfWorkers- the numberOfWorkers value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
optimizer
Get the optimizer property: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'.- Returns:
- the optimizer value.
-
withOptimizer
Set the optimizer property: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'.- Parameters:
optimizer- the optimizer value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
randomSeed
Get the randomSeed property: Random seed to be used when using deterministic training.- Returns:
- the randomSeed value.
-
withRandomSeed
Set the randomSeed property: Random seed to be used when using deterministic training.- Parameters:
randomSeed- the randomSeed value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
stepLRGamma
Get the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].- Returns:
- the stepLRGamma value.
-
withStepLRGamma
Set the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].- Parameters:
stepLRGamma- the stepLRGamma value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
stepLRStepSize
Get the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'. Must be a positive integer.- Returns:
- the stepLRStepSize value.
-
withStepLRStepSize
Set the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'. Must be a positive integer.- Parameters:
stepLRStepSize- the stepLRStepSize value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
trainingBatchSize
Get the trainingBatchSize property: Training batch size. Must be a positive integer.- Returns:
- the trainingBatchSize value.
-
withTrainingBatchSize
Set the trainingBatchSize property: Training batch size. Must be a positive integer.- Parameters:
trainingBatchSize- the trainingBatchSize value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
validationBatchSize
Get the validationBatchSize property: Validation batch size. Must be a positive integer.- Returns:
- the validationBatchSize value.
-
withValidationBatchSize
Set the validationBatchSize property: Validation batch size. Must be a positive integer.- Parameters:
validationBatchSize- the validationBatchSize value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
warmupCosineLRCycles
Get the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].- Returns:
- the warmupCosineLRCycles value.
-
withWarmupCosineLRCycles
Set the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].- Parameters:
warmupCosineLRCycles- the warmupCosineLRCycles value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
warmupCosineLRWarmupEpochs
Get the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.- Returns:
- the warmupCosineLRWarmupEpochs value.
-
withWarmupCosineLRWarmupEpochs
public ImageModelDistributionSettings withWarmupCosineLRWarmupEpochs(String warmupCosineLRWarmupEpochs) Set the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.- Parameters:
warmupCosineLRWarmupEpochs- the warmupCosineLRWarmupEpochs value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
weightDecay
Get the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].- Returns:
- the weightDecay value.
-
withWeightDecay
Set the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].- Parameters:
weightDecay- the weightDecay value to set.- Returns:
- the ImageModelDistributionSettings object itself.
-
validate
public void validate()Validates the instance.- Throws:
IllegalArgumentException- thrown if the instance is not valid.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<ImageModelDistributionSettings>- Throws:
IOException
-
fromJson
public static ImageModelDistributionSettings fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of ImageModelDistributionSettings from the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of ImageModelDistributionSettings if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IOException- If an error occurs while reading the ImageModelDistributionSettings.
-