com.azure.resourcemanager.machinelearning.models.TrainingSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-machinelearning Show documentation
Show all versions of azure-resourcemanager-machinelearning Show documentation
This package contains Microsoft Azure SDK for Machine Learning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. These APIs allow end users to operate on Azure Machine Learning Workspace resources. Package tag package-2024-04.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.machinelearning.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.Duration;
/**
* Training related configuration.
*/
@Fluent
public class TrainingSettings implements JsonSerializable {
/*
* Flag for enabling onnx compatible models.
*/
private Boolean enableOnnxCompatibleModels;
/*
* Stack ensemble settings for stack ensemble run.
*/
private StackEnsembleSettings stackEnsembleSettings;
/*
* Enable stack ensemble run.
*/
private Boolean enableStackEnsemble;
/*
* Enable voting ensemble run.
*/
private Boolean enableVoteEnsemble;
/*
* During VotingEnsemble and StackEnsemble model generation, multiple fitted models from the previous child runs are
* downloaded.
* Configure this parameter with a higher value than 300 secs, if more time is needed.
*/
private Duration ensembleModelDownloadTimeout;
/*
* Flag to turn on explainability on best model.
*/
private Boolean enableModelExplainability;
/*
* Enable recommendation of DNN models.
*/
private Boolean enableDnnTraining;
/**
* Creates an instance of TrainingSettings class.
*/
public TrainingSettings() {
}
/**
* Get the enableOnnxCompatibleModels property: Flag for enabling onnx compatible models.
*
* @return the enableOnnxCompatibleModels value.
*/
public Boolean enableOnnxCompatibleModels() {
return this.enableOnnxCompatibleModels;
}
/**
* Set the enableOnnxCompatibleModels property: Flag for enabling onnx compatible models.
*
* @param enableOnnxCompatibleModels the enableOnnxCompatibleModels value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withEnableOnnxCompatibleModels(Boolean enableOnnxCompatibleModels) {
this.enableOnnxCompatibleModels = enableOnnxCompatibleModels;
return this;
}
/**
* Get the stackEnsembleSettings property: Stack ensemble settings for stack ensemble run.
*
* @return the stackEnsembleSettings value.
*/
public StackEnsembleSettings stackEnsembleSettings() {
return this.stackEnsembleSettings;
}
/**
* Set the stackEnsembleSettings property: Stack ensemble settings for stack ensemble run.
*
* @param stackEnsembleSettings the stackEnsembleSettings value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withStackEnsembleSettings(StackEnsembleSettings stackEnsembleSettings) {
this.stackEnsembleSettings = stackEnsembleSettings;
return this;
}
/**
* Get the enableStackEnsemble property: Enable stack ensemble run.
*
* @return the enableStackEnsemble value.
*/
public Boolean enableStackEnsemble() {
return this.enableStackEnsemble;
}
/**
* Set the enableStackEnsemble property: Enable stack ensemble run.
*
* @param enableStackEnsemble the enableStackEnsemble value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withEnableStackEnsemble(Boolean enableStackEnsemble) {
this.enableStackEnsemble = enableStackEnsemble;
return this;
}
/**
* Get the enableVoteEnsemble property: Enable voting ensemble run.
*
* @return the enableVoteEnsemble value.
*/
public Boolean enableVoteEnsemble() {
return this.enableVoteEnsemble;
}
/**
* Set the enableVoteEnsemble property: Enable voting ensemble run.
*
* @param enableVoteEnsemble the enableVoteEnsemble value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withEnableVoteEnsemble(Boolean enableVoteEnsemble) {
this.enableVoteEnsemble = enableVoteEnsemble;
return this;
}
/**
* Get the ensembleModelDownloadTimeout property: During VotingEnsemble and StackEnsemble model generation, multiple
* fitted models from the previous child runs are downloaded.
* Configure this parameter with a higher value than 300 secs, if more time is needed.
*
* @return the ensembleModelDownloadTimeout value.
*/
public Duration ensembleModelDownloadTimeout() {
return this.ensembleModelDownloadTimeout;
}
/**
* Set the ensembleModelDownloadTimeout property: During VotingEnsemble and StackEnsemble model generation, multiple
* fitted models from the previous child runs are downloaded.
* Configure this parameter with a higher value than 300 secs, if more time is needed.
*
* @param ensembleModelDownloadTimeout the ensembleModelDownloadTimeout value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withEnsembleModelDownloadTimeout(Duration ensembleModelDownloadTimeout) {
this.ensembleModelDownloadTimeout = ensembleModelDownloadTimeout;
return this;
}
/**
* Get the enableModelExplainability property: Flag to turn on explainability on best model.
*
* @return the enableModelExplainability value.
*/
public Boolean enableModelExplainability() {
return this.enableModelExplainability;
}
/**
* Set the enableModelExplainability property: Flag to turn on explainability on best model.
*
* @param enableModelExplainability the enableModelExplainability value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withEnableModelExplainability(Boolean enableModelExplainability) {
this.enableModelExplainability = enableModelExplainability;
return this;
}
/**
* Get the enableDnnTraining property: Enable recommendation of DNN models.
*
* @return the enableDnnTraining value.
*/
public Boolean enableDnnTraining() {
return this.enableDnnTraining;
}
/**
* Set the enableDnnTraining property: Enable recommendation of DNN models.
*
* @param enableDnnTraining the enableDnnTraining value to set.
* @return the TrainingSettings object itself.
*/
public TrainingSettings withEnableDnnTraining(Boolean enableDnnTraining) {
this.enableDnnTraining = enableDnnTraining;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (stackEnsembleSettings() != null) {
stackEnsembleSettings().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("enableOnnxCompatibleModels", this.enableOnnxCompatibleModels);
jsonWriter.writeJsonField("stackEnsembleSettings", this.stackEnsembleSettings);
jsonWriter.writeBooleanField("enableStackEnsemble", this.enableStackEnsemble);
jsonWriter.writeBooleanField("enableVoteEnsemble", this.enableVoteEnsemble);
jsonWriter.writeStringField("ensembleModelDownloadTimeout",
CoreUtils.durationToStringWithDays(this.ensembleModelDownloadTimeout));
jsonWriter.writeBooleanField("enableModelExplainability", this.enableModelExplainability);
jsonWriter.writeBooleanField("enableDnnTraining", this.enableDnnTraining);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of TrainingSettings from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of TrainingSettings 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 TrainingSettings.
*/
public static TrainingSettings fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
TrainingSettings deserializedTrainingSettings = new TrainingSettings();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("enableOnnxCompatibleModels".equals(fieldName)) {
deserializedTrainingSettings.enableOnnxCompatibleModels
= reader.getNullable(JsonReader::getBoolean);
} else if ("stackEnsembleSettings".equals(fieldName)) {
deserializedTrainingSettings.stackEnsembleSettings = StackEnsembleSettings.fromJson(reader);
} else if ("enableStackEnsemble".equals(fieldName)) {
deserializedTrainingSettings.enableStackEnsemble = reader.getNullable(JsonReader::getBoolean);
} else if ("enableVoteEnsemble".equals(fieldName)) {
deserializedTrainingSettings.enableVoteEnsemble = reader.getNullable(JsonReader::getBoolean);
} else if ("ensembleModelDownloadTimeout".equals(fieldName)) {
deserializedTrainingSettings.ensembleModelDownloadTimeout
= reader.getNullable(nonNullReader -> Duration.parse(nonNullReader.getString()));
} else if ("enableModelExplainability".equals(fieldName)) {
deserializedTrainingSettings.enableModelExplainability = reader.getNullable(JsonReader::getBoolean);
} else if ("enableDnnTraining".equals(fieldName)) {
deserializedTrainingSettings.enableDnnTraining = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedTrainingSettings;
});
}
}