Class ImageModelDistributionSettingsClassification

java.lang.Object
com.azure.resourcemanager.machinelearning.models.ImageModelDistributionSettings
com.azure.resourcemanager.machinelearning.models.ImageModelDistributionSettingsClassification
All Implemented Interfaces:
com.azure.json.JsonSerializable<ImageModelDistributionSettings>

public final class ImageModelDistributionSettingsClassification extends 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> 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 Details

    • ImageModelDistributionSettingsClassification

      public ImageModelDistributionSettingsClassification()
      Creates an instance of ImageModelDistributionSettingsClassification class.
  • Method Details

    • trainingCropSize

      public String trainingCropSize()
      Get the trainingCropSize property: Image crop size that is input to the neural network for the training dataset. Must be a positive integer.
      Returns:
      the trainingCropSize value.
    • withTrainingCropSize

      public ImageModelDistributionSettingsClassification withTrainingCropSize(String trainingCropSize)
      Set the trainingCropSize property: Image crop size that is input to the neural network for the training dataset. Must be a positive integer.
      Parameters:
      trainingCropSize - the trainingCropSize value to set.
      Returns:
      the ImageModelDistributionSettingsClassification object itself.
    • validationCropSize

      public String validationCropSize()
      Get the validationCropSize property: Image crop size that is input to the neural network for the validation dataset. Must be a positive integer.
      Returns:
      the validationCropSize value.
    • withValidationCropSize

      public ImageModelDistributionSettingsClassification withValidationCropSize(String validationCropSize)
      Set the validationCropSize property: Image crop size that is input to the neural network for the validation dataset. Must be a positive integer.
      Parameters:
      validationCropSize - the validationCropSize value to set.
      Returns:
      the ImageModelDistributionSettingsClassification object itself.
    • validationResizeSize

      public String validationResizeSize()
      Get the validationResizeSize property: Image size to which to resize before cropping for validation dataset. Must be a positive integer.
      Returns:
      the validationResizeSize value.
    • withValidationResizeSize

      public ImageModelDistributionSettingsClassification withValidationResizeSize(String validationResizeSize)
      Set the validationResizeSize property: Image size to which to resize before cropping for validation dataset. Must be a positive integer.
      Parameters:
      validationResizeSize - the validationResizeSize value to set.
      Returns:
      the ImageModelDistributionSettingsClassification object itself.
    • weightedLoss

      public String weightedLoss()
      Get the weightedLoss property: Weighted loss. The accepted values are 0 for no weighted loss. 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be 0 or 1 or 2.
      Returns:
      the weightedLoss value.
    • withWeightedLoss

      public ImageModelDistributionSettingsClassification withWeightedLoss(String weightedLoss)
      Set the weightedLoss property: Weighted loss. The accepted values are 0 for no weighted loss. 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be 0 or 1 or 2.
      Parameters:
      weightedLoss - the weightedLoss value to set.
      Returns:
      the ImageModelDistributionSettingsClassification object itself.
    • withAmsGradient

      public ImageModelDistributionSettingsClassification withAmsGradient(String amsGradient)
      Set the amsGradient property: Enable AMSGrad when optimizer is 'adam' or 'adamw'.
      Overrides:
      withAmsGradient in class ImageModelDistributionSettings
      Parameters:
      amsGradient - the amsGradient value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withAugmentations

      public ImageModelDistributionSettingsClassification withAugmentations(String augmentations)
      Set the augmentations property: Settings for using Augmentations.
      Overrides:
      withAugmentations in class ImageModelDistributionSettings
      Parameters:
      augmentations - the augmentations value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withBeta1

      Set the beta1 property: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].
      Overrides:
      withBeta1 in class ImageModelDistributionSettings
      Parameters:
      beta1 - the beta1 value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withBeta2

      Set the beta2 property: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range [0, 1].
      Overrides:
      withBeta2 in class ImageModelDistributionSettings
      Parameters:
      beta2 - the beta2 value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withDistributed

      public ImageModelDistributionSettingsClassification withDistributed(String distributed)
      Set the distributed property: Whether to use distributer training.
      Overrides:
      withDistributed in class ImageModelDistributionSettings
      Parameters:
      distributed - the distributed value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withEarlyStopping

      public ImageModelDistributionSettingsClassification withEarlyStopping(String earlyStopping)
      Set the earlyStopping property: Enable early stopping logic during training.
      Overrides:
      withEarlyStopping in class ImageModelDistributionSettings
      Parameters:
      earlyStopping - the earlyStopping value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withEarlyStoppingDelay

      public ImageModelDistributionSettingsClassification 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. Must be a positive integer.
      Overrides:
      withEarlyStoppingDelay in class ImageModelDistributionSettings
      Parameters:
      earlyStoppingDelay - the earlyStoppingDelay value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withEarlyStoppingPatience

      public ImageModelDistributionSettingsClassification withEarlyStoppingPatience(String earlyStoppingPatience)
      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.
      Overrides:
      withEarlyStoppingPatience in class ImageModelDistributionSettings
      Parameters:
      earlyStoppingPatience - the earlyStoppingPatience value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withEvaluationFrequency

      public ImageModelDistributionSettingsClassification withEvaluationFrequency(String evaluationFrequency)
      Set the evaluationFrequency property: Frequency to evaluate validation dataset to get metric scores. Must be a positive integer.
      Overrides:
      withEvaluationFrequency in class ImageModelDistributionSettings
      Parameters:
      evaluationFrequency - the evaluationFrequency value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withEnableOnnxNormalization

      public ImageModelDistributionSettingsClassification withEnableOnnxNormalization(String enableOnnxNormalization)
      Set the enableOnnxNormalization property: Enable normalization when exporting ONNX model.
      Overrides:
      withEnableOnnxNormalization in class ImageModelDistributionSettings
      Parameters:
      enableOnnxNormalization - the enableOnnxNormalization value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withGradientAccumulationStep

      public ImageModelDistributionSettingsClassification 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. Must be a positive integer.
      Overrides:
      withGradientAccumulationStep in class ImageModelDistributionSettings
      Parameters:
      gradientAccumulationStep - the gradientAccumulationStep value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withLayersToFreeze

      public ImageModelDistributionSettingsClassification withLayersToFreeze(String layersToFreeze)
      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.
      Overrides:
      withLayersToFreeze in class ImageModelDistributionSettings
      Parameters:
      layersToFreeze - the layersToFreeze value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withLearningRate

      public ImageModelDistributionSettingsClassification withLearningRate(String learningRate)
      Set the learningRate property: Initial learning rate. Must be a float in the range [0, 1].
      Overrides:
      withLearningRate in class ImageModelDistributionSettings
      Parameters:
      learningRate - the learningRate value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withLearningRateScheduler

      public ImageModelDistributionSettingsClassification withLearningRateScheduler(String learningRateScheduler)
      Set the learningRateScheduler property: Type of learning rate scheduler. Must be 'warmup_cosine' or 'step'.
      Overrides:
      withLearningRateScheduler in class ImageModelDistributionSettings
      Parameters:
      learningRateScheduler - the learningRateScheduler value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withModelName

      public ImageModelDistributionSettingsClassification withModelName(String modelName)
      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.
      Overrides:
      withModelName in class ImageModelDistributionSettings
      Parameters:
      modelName - the modelName value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withMomentum

      public ImageModelDistributionSettingsClassification withMomentum(String momentum)
      Set the momentum property: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1].
      Overrides:
      withMomentum in class ImageModelDistributionSettings
      Parameters:
      momentum - the momentum value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withNesterov

      public ImageModelDistributionSettingsClassification withNesterov(String nesterov)
      Set the nesterov property: Enable nesterov when optimizer is 'sgd'.
      Overrides:
      withNesterov in class ImageModelDistributionSettings
      Parameters:
      nesterov - the nesterov value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withNumberOfEpochs

      public ImageModelDistributionSettingsClassification withNumberOfEpochs(String numberOfEpochs)
      Set the numberOfEpochs property: Number of training epochs. Must be a positive integer.
      Overrides:
      withNumberOfEpochs in class ImageModelDistributionSettings
      Parameters:
      numberOfEpochs - the numberOfEpochs value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withNumberOfWorkers

      public ImageModelDistributionSettingsClassification withNumberOfWorkers(String numberOfWorkers)
      Set the numberOfWorkers property: Number of data loader workers. Must be a non-negative integer.
      Overrides:
      withNumberOfWorkers in class ImageModelDistributionSettings
      Parameters:
      numberOfWorkers - the numberOfWorkers value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withOptimizer

      public ImageModelDistributionSettingsClassification withOptimizer(String optimizer)
      Set the optimizer property: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'.
      Overrides:
      withOptimizer in class ImageModelDistributionSettings
      Parameters:
      optimizer - the optimizer value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withRandomSeed

      public ImageModelDistributionSettingsClassification withRandomSeed(String randomSeed)
      Set the randomSeed property: Random seed to be used when using deterministic training.
      Overrides:
      withRandomSeed in class ImageModelDistributionSettings
      Parameters:
      randomSeed - the randomSeed value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withStepLRGamma

      public ImageModelDistributionSettingsClassification withStepLRGamma(String stepLRGamma)
      Set the stepLRGamma property: Value of gamma when learning rate scheduler is 'step'. Must be a float in the range [0, 1].
      Overrides:
      withStepLRGamma in class ImageModelDistributionSettings
      Parameters:
      stepLRGamma - the stepLRGamma value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withStepLRStepSize

      public ImageModelDistributionSettingsClassification withStepLRStepSize(String stepLRStepSize)
      Set the stepLRStepSize property: Value of step size when learning rate scheduler is 'step'. Must be a positive integer.
      Overrides:
      withStepLRStepSize in class ImageModelDistributionSettings
      Parameters:
      stepLRStepSize - the stepLRStepSize value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withTrainingBatchSize

      public ImageModelDistributionSettingsClassification withTrainingBatchSize(String trainingBatchSize)
      Set the trainingBatchSize property: Training batch size. Must be a positive integer.
      Overrides:
      withTrainingBatchSize in class ImageModelDistributionSettings
      Parameters:
      trainingBatchSize - the trainingBatchSize value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withValidationBatchSize

      public ImageModelDistributionSettingsClassification withValidationBatchSize(String validationBatchSize)
      Set the validationBatchSize property: Validation batch size. Must be a positive integer.
      Overrides:
      withValidationBatchSize in class ImageModelDistributionSettings
      Parameters:
      validationBatchSize - the validationBatchSize value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withWarmupCosineLRCycles

      public ImageModelDistributionSettingsClassification withWarmupCosineLRCycles(String warmupCosineLRCycles)
      Set the warmupCosineLRCycles property: Value of cosine cycle when learning rate scheduler is 'warmup_cosine'. Must be a float in the range [0, 1].
      Overrides:
      withWarmupCosineLRCycles in class ImageModelDistributionSettings
      Parameters:
      warmupCosineLRCycles - the warmupCosineLRCycles value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withWarmupCosineLRWarmupEpochs

      public ImageModelDistributionSettingsClassification withWarmupCosineLRWarmupEpochs(String warmupCosineLRWarmupEpochs)
      Set the warmupCosineLRWarmupEpochs property: Value of warmup epochs when learning rate scheduler is 'warmup_cosine'. Must be a positive integer.
      Overrides:
      withWarmupCosineLRWarmupEpochs in class ImageModelDistributionSettings
      Parameters:
      warmupCosineLRWarmupEpochs - the warmupCosineLRWarmupEpochs value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • withWeightDecay

      public ImageModelDistributionSettingsClassification withWeightDecay(String weightDecay)
      Set the weightDecay property: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be a float in the range[0, 1].
      Overrides:
      withWeightDecay in class ImageModelDistributionSettings
      Parameters:
      weightDecay - the weightDecay value to set.
      Returns:
      the ImageModelDistributionSettings object itself.
    • validate

      public void validate()
      Validates the instance.
      Overrides:
      validate in class ImageModelDistributionSettings
      Throws:
      IllegalArgumentException - thrown if the instance is not valid.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ImageModelDistributionSettings>
      Overrides:
      toJson in class ImageModelDistributionSettings
      Throws:
      IOException
    • fromJson

      public static ImageModelDistributionSettingsClassification fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of ImageModelDistributionSettingsClassification from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of ImageModelDistributionSettingsClassification 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 ImageModelDistributionSettingsClassification.