All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.sagemaker.model.HyperParameterTrainingJobDefinition Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon SageMaker module holds the client classes that are used for communicating with Amazon SageMaker Service

There is a newer version: 2.28.4
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.sagemaker.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Defines the training jobs launched by a hyperparameter tuning job. *

*/ @Generated("software.amazon.awssdk:codegen") public final class HyperParameterTrainingJobDefinition implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DEFINITION_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DefinitionName").getter(getter(HyperParameterTrainingJobDefinition::definitionName)) .setter(setter(Builder::definitionName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefinitionName").build()).build(); private static final SdkField TUNING_OBJECTIVE_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("TuningObjective") .getter(getter(HyperParameterTrainingJobDefinition::tuningObjective)).setter(setter(Builder::tuningObjective)) .constructor(HyperParameterTuningJobObjective::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TuningObjective").build()).build(); private static final SdkField HYPER_PARAMETER_RANGES_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("HyperParameterRanges") .getter(getter(HyperParameterTrainingJobDefinition::hyperParameterRanges)) .setter(setter(Builder::hyperParameterRanges)).constructor(ParameterRanges::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HyperParameterRanges").build()) .build(); private static final SdkField> STATIC_HYPER_PARAMETERS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("StaticHyperParameters") .getter(getter(HyperParameterTrainingJobDefinition::staticHyperParameters)) .setter(setter(Builder::staticHyperParameters)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StaticHyperParameters").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField ALGORITHM_SPECIFICATION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("AlgorithmSpecification") .getter(getter(HyperParameterTrainingJobDefinition::algorithmSpecification)) .setter(setter(Builder::algorithmSpecification)).constructor(HyperParameterAlgorithmSpecification::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlgorithmSpecification").build()) .build(); private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RoleArn").getter(getter(HyperParameterTrainingJobDefinition::roleArn)).setter(setter(Builder::roleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build(); private static final SdkField> INPUT_DATA_CONFIG_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("InputDataConfig") .getter(getter(HyperParameterTrainingJobDefinition::inputDataConfig)) .setter(setter(Builder::inputDataConfig)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputDataConfig").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Channel::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("VpcConfig").getter(getter(HyperParameterTrainingJobDefinition::vpcConfig)) .setter(setter(Builder::vpcConfig)).constructor(VpcConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfig").build()).build(); private static final SdkField OUTPUT_DATA_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("OutputDataConfig") .getter(getter(HyperParameterTrainingJobDefinition::outputDataConfig)).setter(setter(Builder::outputDataConfig)) .constructor(OutputDataConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputDataConfig").build()).build(); private static final SdkField RESOURCE_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("ResourceConfig") .getter(getter(HyperParameterTrainingJobDefinition::resourceConfig)).setter(setter(Builder::resourceConfig)) .constructor(ResourceConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceConfig").build()).build(); private static final SdkField HYPER_PARAMETER_TUNING_RESOURCE_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("HyperParameterTuningResourceConfig") .getter(getter(HyperParameterTrainingJobDefinition::hyperParameterTuningResourceConfig)) .setter(setter(Builder::hyperParameterTuningResourceConfig)) .constructor(HyperParameterTuningResourceConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HyperParameterTuningResourceConfig") .build()).build(); private static final SdkField STOPPING_CONDITION_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("StoppingCondition") .getter(getter(HyperParameterTrainingJobDefinition::stoppingCondition)).setter(setter(Builder::stoppingCondition)) .constructor(StoppingCondition::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StoppingCondition").build()).build(); private static final SdkField ENABLE_NETWORK_ISOLATION_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("EnableNetworkIsolation").getter(getter(HyperParameterTrainingJobDefinition::enableNetworkIsolation)) .setter(setter(Builder::enableNetworkIsolation)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableNetworkIsolation").build()) .build(); private static final SdkField ENABLE_INTER_CONTAINER_TRAFFIC_ENCRYPTION_FIELD = SdkField . builder(MarshallingType.BOOLEAN) .memberName("EnableInterContainerTrafficEncryption") .getter(getter(HyperParameterTrainingJobDefinition::enableInterContainerTrafficEncryption)) .setter(setter(Builder::enableInterContainerTrafficEncryption)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("EnableInterContainerTrafficEncryption").build()).build(); private static final SdkField ENABLE_MANAGED_SPOT_TRAINING_FIELD = SdkField . builder(MarshallingType.BOOLEAN).memberName("EnableManagedSpotTraining") .getter(getter(HyperParameterTrainingJobDefinition::enableManagedSpotTraining)) .setter(setter(Builder::enableManagedSpotTraining)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableManagedSpotTraining").build()) .build(); private static final SdkField CHECKPOINT_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("CheckpointConfig") .getter(getter(HyperParameterTrainingJobDefinition::checkpointConfig)).setter(setter(Builder::checkpointConfig)) .constructor(CheckpointConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CheckpointConfig").build()).build(); private static final SdkField RETRY_STRATEGY_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("RetryStrategy") .getter(getter(HyperParameterTrainingJobDefinition::retryStrategy)).setter(setter(Builder::retryStrategy)) .constructor(RetryStrategy::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RetryStrategy").build()).build(); private static final SdkField> ENVIRONMENT_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("Environment") .getter(getter(HyperParameterTrainingJobDefinition::environment)) .setter(setter(Builder::environment)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Environment").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEFINITION_NAME_FIELD, TUNING_OBJECTIVE_FIELD, HYPER_PARAMETER_RANGES_FIELD, STATIC_HYPER_PARAMETERS_FIELD, ALGORITHM_SPECIFICATION_FIELD, ROLE_ARN_FIELD, INPUT_DATA_CONFIG_FIELD, VPC_CONFIG_FIELD, OUTPUT_DATA_CONFIG_FIELD, RESOURCE_CONFIG_FIELD, HYPER_PARAMETER_TUNING_RESOURCE_CONFIG_FIELD, STOPPING_CONDITION_FIELD, ENABLE_NETWORK_ISOLATION_FIELD, ENABLE_INTER_CONTAINER_TRAFFIC_ENCRYPTION_FIELD, ENABLE_MANAGED_SPOT_TRAINING_FIELD, CHECKPOINT_CONFIG_FIELD, RETRY_STRATEGY_FIELD, ENVIRONMENT_FIELD)); private static final long serialVersionUID = 1L; private final String definitionName; private final HyperParameterTuningJobObjective tuningObjective; private final ParameterRanges hyperParameterRanges; private final Map staticHyperParameters; private final HyperParameterAlgorithmSpecification algorithmSpecification; private final String roleArn; private final List inputDataConfig; private final VpcConfig vpcConfig; private final OutputDataConfig outputDataConfig; private final ResourceConfig resourceConfig; private final HyperParameterTuningResourceConfig hyperParameterTuningResourceConfig; private final StoppingCondition stoppingCondition; private final Boolean enableNetworkIsolation; private final Boolean enableInterContainerTrafficEncryption; private final Boolean enableManagedSpotTraining; private final CheckpointConfig checkpointConfig; private final RetryStrategy retryStrategy; private final Map environment; private HyperParameterTrainingJobDefinition(BuilderImpl builder) { this.definitionName = builder.definitionName; this.tuningObjective = builder.tuningObjective; this.hyperParameterRanges = builder.hyperParameterRanges; this.staticHyperParameters = builder.staticHyperParameters; this.algorithmSpecification = builder.algorithmSpecification; this.roleArn = builder.roleArn; this.inputDataConfig = builder.inputDataConfig; this.vpcConfig = builder.vpcConfig; this.outputDataConfig = builder.outputDataConfig; this.resourceConfig = builder.resourceConfig; this.hyperParameterTuningResourceConfig = builder.hyperParameterTuningResourceConfig; this.stoppingCondition = builder.stoppingCondition; this.enableNetworkIsolation = builder.enableNetworkIsolation; this.enableInterContainerTrafficEncryption = builder.enableInterContainerTrafficEncryption; this.enableManagedSpotTraining = builder.enableManagedSpotTraining; this.checkpointConfig = builder.checkpointConfig; this.retryStrategy = builder.retryStrategy; this.environment = builder.environment; } /** *

* The job definition name. *

* * @return The job definition name. */ public final String definitionName() { return definitionName; } /** * Returns the value of the TuningObjective property for this object. * * @return The value of the TuningObjective property for this object. */ public final HyperParameterTuningJobObjective tuningObjective() { return tuningObjective; } /** * Returns the value of the HyperParameterRanges property for this object. * * @return The value of the HyperParameterRanges property for this object. */ public final ParameterRanges hyperParameterRanges() { return hyperParameterRanges; } /** * For responses, this returns true if the service returned a value for the StaticHyperParameters property. This * DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the * property). This is useful because the SDK will never return a null collection or map, but you may need to * differentiate between the service returning nothing (or null) and the service returning an empty collection or * map. For requests, this returns true if a value for the property was specified in the request builder, and false * if a value was not specified. */ public final boolean hasStaticHyperParameters() { return staticHyperParameters != null && !(staticHyperParameters instanceof SdkAutoConstructMap); } /** *

* Specifies the values of hyperparameters that do not change for the tuning job. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasStaticHyperParameters} method. *

* * @return Specifies the values of hyperparameters that do not change for the tuning job. */ public final Map staticHyperParameters() { return staticHyperParameters; } /** *

* The HyperParameterAlgorithmSpecification object that specifies the resource algorithm to use for the training * jobs that the tuning job launches. *

* * @return The HyperParameterAlgorithmSpecification object that specifies the resource algorithm to use for the * training jobs that the tuning job launches. */ public final HyperParameterAlgorithmSpecification algorithmSpecification() { return algorithmSpecification; } /** *

* The Amazon Resource Name (ARN) of the IAM role associated with the training jobs that the tuning job launches. *

* * @return The Amazon Resource Name (ARN) of the IAM role associated with the training jobs that the tuning job * launches. */ public final String roleArn() { return roleArn; } /** * For responses, this returns true if the service returned a value for the InputDataConfig property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasInputDataConfig() { return inputDataConfig != null && !(inputDataConfig instanceof SdkAutoConstructList); } /** *

* An array of Channel * objects that specify the input for the training jobs that the tuning job launches. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasInputDataConfig} method. *

* * @return An array of Channel objects * that specify the input for the training jobs that the tuning job launches. */ public final List inputDataConfig() { return inputDataConfig; } /** *

* The VpcConfig object * that specifies the VPC that you want the training jobs that this hyperparameter tuning job launches to connect * to. Control access to and from your training container by configuring the VPC. For more information, see Protect Training Jobs by Using an Amazon * Virtual Private Cloud. *

* * @return The VpcConfig * object that specifies the VPC that you want the training jobs that this hyperparameter tuning job * launches to connect to. Control access to and from your training container by configuring the VPC. For * more information, see Protect * Training Jobs by Using an Amazon Virtual Private Cloud. */ public final VpcConfig vpcConfig() { return vpcConfig; } /** *

* Specifies the path to the Amazon S3 bucket where you store model artifacts from the training jobs that the tuning * job launches. *

* * @return Specifies the path to the Amazon S3 bucket where you store model artifacts from the training jobs that * the tuning job launches. */ public final OutputDataConfig outputDataConfig() { return outputDataConfig; } /** *

* The resources, including the compute instances and storage volumes, to use for the training jobs that the tuning * job launches. *

*

* Storage volumes store model artifacts and incremental states. Training algorithms might also use storage volumes * for scratch space. If you want SageMaker to use the storage volume to store the training data, choose * File as the TrainingInputMode in the algorithm specification. For distributed training * algorithms, specify an instance count greater than 1. *

* *

* If you want to use hyperparameter optimization with instance type flexibility, use * HyperParameterTuningResourceConfig instead. *

*
* * @return The resources, including the compute instances and storage volumes, to use for the training jobs that the * tuning job launches.

*

* Storage volumes store model artifacts and incremental states. Training algorithms might also use storage * volumes for scratch space. If you want SageMaker to use the storage volume to store the training data, * choose File as the TrainingInputMode in the algorithm specification. For * distributed training algorithms, specify an instance count greater than 1. *

* *

* If you want to use hyperparameter optimization with instance type flexibility, use * HyperParameterTuningResourceConfig instead. *

*/ public final ResourceConfig resourceConfig() { return resourceConfig; } /** *

* The configuration for the hyperparameter tuning resources, including the compute instances and storage volumes, * used for training jobs launched by the tuning job. By default, storage volumes hold model artifacts and * incremental states. Choose File for TrainingInputMode in the * AlgorithmSpecification parameter to additionally store training data in the storage volume * (optional). *

* * @return The configuration for the hyperparameter tuning resources, including the compute instances and storage * volumes, used for training jobs launched by the tuning job. By default, storage volumes hold model * artifacts and incremental states. Choose File for TrainingInputMode in the * AlgorithmSpecification parameter to additionally store training data in the storage volume * (optional). */ public final HyperParameterTuningResourceConfig hyperParameterTuningResourceConfig() { return hyperParameterTuningResourceConfig; } /** *

* Specifies a limit to how long a model hyperparameter training job can run. It also specifies how long a managed * spot training job has to complete. When the job reaches the time limit, SageMaker ends the training job. Use this * API to cap model training costs. *

* * @return Specifies a limit to how long a model hyperparameter training job can run. It also specifies how long a * managed spot training job has to complete. When the job reaches the time limit, SageMaker ends the * training job. Use this API to cap model training costs. */ public final StoppingCondition stoppingCondition() { return stoppingCondition; } /** *

* Isolates the training container. No inbound or outbound network calls can be made, except for calls between peers * within a training cluster for distributed training. If network isolation is used for training jobs that are * configured to use a VPC, SageMaker downloads and uploads customer data and model artifacts through the specified * VPC, but the training container does not have network access. *

* * @return Isolates the training container. No inbound or outbound network calls can be made, except for calls * between peers within a training cluster for distributed training. If network isolation is used for * training jobs that are configured to use a VPC, SageMaker downloads and uploads customer data and model * artifacts through the specified VPC, but the training container does not have network access. */ public final Boolean enableNetworkIsolation() { return enableNetworkIsolation; } /** *

* To encrypt all communications between ML compute instances in distributed training, choose True. * Encryption provides greater security for distributed training, but training might take longer. How long it takes * depends on the amount of communication between compute instances, especially if you use a deep learning algorithm * in distributed training. *

* * @return To encrypt all communications between ML compute instances in distributed training, choose * True. Encryption provides greater security for distributed training, but training might take * longer. How long it takes depends on the amount of communication between compute instances, especially if * you use a deep learning algorithm in distributed training. */ public final Boolean enableInterContainerTrafficEncryption() { return enableInterContainerTrafficEncryption; } /** *

* A Boolean indicating whether managed spot training is enabled (True) or not (False). *

* * @return A Boolean indicating whether managed spot training is enabled (True) or not ( * False). */ public final Boolean enableManagedSpotTraining() { return enableManagedSpotTraining; } /** * Returns the value of the CheckpointConfig property for this object. * * @return The value of the CheckpointConfig property for this object. */ public final CheckpointConfig checkpointConfig() { return checkpointConfig; } /** *

* The number of times to retry the job when the job fails due to an InternalServerError. *

* * @return The number of times to retry the job when the job fails due to an InternalServerError. */ public final RetryStrategy retryStrategy() { return retryStrategy; } /** * For responses, this returns true if the service returned a value for the Environment property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasEnvironment() { return environment != null && !(environment instanceof SdkAutoConstructMap); } /** *

* An environment variable that you can pass into the SageMaker CreateTrainingJob * API. You can use an existing environment variable from the training container or use your own. See Define metrics and variables for more information. *

* *

* The maximum number of items specified for Map Entries refers to the maximum number of environment * variables for each TrainingJobDefinition and also the maximum for the hyperparameter tuning job * itself. That is, the sum of the number of environment variables for all the training job definitions can't exceed * the maximum number specified. *

*
*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasEnvironment} method. *

* * @return An environment variable that you can pass into the SageMaker CreateTrainingJob API. You can use an existing environment variable from the training container or use your own. See Define metrics and variables for more information.

*

* The maximum number of items specified for Map Entries refers to the maximum number of * environment variables for each TrainingJobDefinition and also the maximum for the * hyperparameter tuning job itself. That is, the sum of the number of environment variables for all the * training job definitions can't exceed the maximum number specified. *

*/ public final Map environment() { return environment; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(definitionName()); hashCode = 31 * hashCode + Objects.hashCode(tuningObjective()); hashCode = 31 * hashCode + Objects.hashCode(hyperParameterRanges()); hashCode = 31 * hashCode + Objects.hashCode(hasStaticHyperParameters() ? staticHyperParameters() : null); hashCode = 31 * hashCode + Objects.hashCode(algorithmSpecification()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(hasInputDataConfig() ? inputDataConfig() : null); hashCode = 31 * hashCode + Objects.hashCode(vpcConfig()); hashCode = 31 * hashCode + Objects.hashCode(outputDataConfig()); hashCode = 31 * hashCode + Objects.hashCode(resourceConfig()); hashCode = 31 * hashCode + Objects.hashCode(hyperParameterTuningResourceConfig()); hashCode = 31 * hashCode + Objects.hashCode(stoppingCondition()); hashCode = 31 * hashCode + Objects.hashCode(enableNetworkIsolation()); hashCode = 31 * hashCode + Objects.hashCode(enableInterContainerTrafficEncryption()); hashCode = 31 * hashCode + Objects.hashCode(enableManagedSpotTraining()); hashCode = 31 * hashCode + Objects.hashCode(checkpointConfig()); hashCode = 31 * hashCode + Objects.hashCode(retryStrategy()); hashCode = 31 * hashCode + Objects.hashCode(hasEnvironment() ? environment() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof HyperParameterTrainingJobDefinition)) { return false; } HyperParameterTrainingJobDefinition other = (HyperParameterTrainingJobDefinition) obj; return Objects.equals(definitionName(), other.definitionName()) && Objects.equals(tuningObjective(), other.tuningObjective()) && Objects.equals(hyperParameterRanges(), other.hyperParameterRanges()) && hasStaticHyperParameters() == other.hasStaticHyperParameters() && Objects.equals(staticHyperParameters(), other.staticHyperParameters()) && Objects.equals(algorithmSpecification(), other.algorithmSpecification()) && Objects.equals(roleArn(), other.roleArn()) && hasInputDataConfig() == other.hasInputDataConfig() && Objects.equals(inputDataConfig(), other.inputDataConfig()) && Objects.equals(vpcConfig(), other.vpcConfig()) && Objects.equals(outputDataConfig(), other.outputDataConfig()) && Objects.equals(resourceConfig(), other.resourceConfig()) && Objects.equals(hyperParameterTuningResourceConfig(), other.hyperParameterTuningResourceConfig()) && Objects.equals(stoppingCondition(), other.stoppingCondition()) && Objects.equals(enableNetworkIsolation(), other.enableNetworkIsolation()) && Objects.equals(enableInterContainerTrafficEncryption(), other.enableInterContainerTrafficEncryption()) && Objects.equals(enableManagedSpotTraining(), other.enableManagedSpotTraining()) && Objects.equals(checkpointConfig(), other.checkpointConfig()) && Objects.equals(retryStrategy(), other.retryStrategy()) && hasEnvironment() == other.hasEnvironment() && Objects.equals(environment(), other.environment()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("HyperParameterTrainingJobDefinition").add("DefinitionName", definitionName()) .add("TuningObjective", tuningObjective()).add("HyperParameterRanges", hyperParameterRanges()) .add("StaticHyperParameters", hasStaticHyperParameters() ? staticHyperParameters() : null) .add("AlgorithmSpecification", algorithmSpecification()).add("RoleArn", roleArn()) .add("InputDataConfig", hasInputDataConfig() ? inputDataConfig() : null).add("VpcConfig", vpcConfig()) .add("OutputDataConfig", outputDataConfig()).add("ResourceConfig", resourceConfig()) .add("HyperParameterTuningResourceConfig", hyperParameterTuningResourceConfig()) .add("StoppingCondition", stoppingCondition()).add("EnableNetworkIsolation", enableNetworkIsolation()) .add("EnableInterContainerTrafficEncryption", enableInterContainerTrafficEncryption()) .add("EnableManagedSpotTraining", enableManagedSpotTraining()).add("CheckpointConfig", checkpointConfig()) .add("RetryStrategy", retryStrategy()).add("Environment", hasEnvironment() ? environment() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "DefinitionName": return Optional.ofNullable(clazz.cast(definitionName())); case "TuningObjective": return Optional.ofNullable(clazz.cast(tuningObjective())); case "HyperParameterRanges": return Optional.ofNullable(clazz.cast(hyperParameterRanges())); case "StaticHyperParameters": return Optional.ofNullable(clazz.cast(staticHyperParameters())); case "AlgorithmSpecification": return Optional.ofNullable(clazz.cast(algorithmSpecification())); case "RoleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "InputDataConfig": return Optional.ofNullable(clazz.cast(inputDataConfig())); case "VpcConfig": return Optional.ofNullable(clazz.cast(vpcConfig())); case "OutputDataConfig": return Optional.ofNullable(clazz.cast(outputDataConfig())); case "ResourceConfig": return Optional.ofNullable(clazz.cast(resourceConfig())); case "HyperParameterTuningResourceConfig": return Optional.ofNullable(clazz.cast(hyperParameterTuningResourceConfig())); case "StoppingCondition": return Optional.ofNullable(clazz.cast(stoppingCondition())); case "EnableNetworkIsolation": return Optional.ofNullable(clazz.cast(enableNetworkIsolation())); case "EnableInterContainerTrafficEncryption": return Optional.ofNullable(clazz.cast(enableInterContainerTrafficEncryption())); case "EnableManagedSpotTraining": return Optional.ofNullable(clazz.cast(enableManagedSpotTraining())); case "CheckpointConfig": return Optional.ofNullable(clazz.cast(checkpointConfig())); case "RetryStrategy": return Optional.ofNullable(clazz.cast(retryStrategy())); case "Environment": return Optional.ofNullable(clazz.cast(environment())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((HyperParameterTrainingJobDefinition) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The job definition name. *

* * @param definitionName * The job definition name. * @return Returns a reference to this object so that method calls can be chained together. */ Builder definitionName(String definitionName); /** * Sets the value of the TuningObjective property for this object. * * @param tuningObjective * The new value for the TuningObjective property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tuningObjective(HyperParameterTuningJobObjective tuningObjective); /** * Sets the value of the TuningObjective property for this object. * * This is a convenience method that creates an instance of the {@link HyperParameterTuningJobObjective.Builder} * avoiding the need to create one manually via {@link HyperParameterTuningJobObjective#builder()}. * *

* When the {@link Consumer} completes, {@link HyperParameterTuningJobObjective.Builder#build()} is called * immediately and its result is passed to {@link #tuningObjective(HyperParameterTuningJobObjective)}. * * @param tuningObjective * a consumer that will call methods on {@link HyperParameterTuningJobObjective.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tuningObjective(HyperParameterTuningJobObjective) */ default Builder tuningObjective(Consumer tuningObjective) { return tuningObjective(HyperParameterTuningJobObjective.builder().applyMutation(tuningObjective).build()); } /** * Sets the value of the HyperParameterRanges property for this object. * * @param hyperParameterRanges * The new value for the HyperParameterRanges property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hyperParameterRanges(ParameterRanges hyperParameterRanges); /** * Sets the value of the HyperParameterRanges property for this object. * * This is a convenience method that creates an instance of the {@link ParameterRanges.Builder} avoiding the * need to create one manually via {@link ParameterRanges#builder()}. * *

* When the {@link Consumer} completes, {@link ParameterRanges.Builder#build()} is called immediately and its * result is passed to {@link #hyperParameterRanges(ParameterRanges)}. * * @param hyperParameterRanges * a consumer that will call methods on {@link ParameterRanges.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #hyperParameterRanges(ParameterRanges) */ default Builder hyperParameterRanges(Consumer hyperParameterRanges) { return hyperParameterRanges(ParameterRanges.builder().applyMutation(hyperParameterRanges).build()); } /** *

* Specifies the values of hyperparameters that do not change for the tuning job. *

* * @param staticHyperParameters * Specifies the values of hyperparameters that do not change for the tuning job. * @return Returns a reference to this object so that method calls can be chained together. */ Builder staticHyperParameters(Map staticHyperParameters); /** *

* The HyperParameterAlgorithmSpecification object that specifies the resource algorithm to use for the * training jobs that the tuning job launches. *

* * @param algorithmSpecification * The HyperParameterAlgorithmSpecification object that specifies the resource algorithm to use for the * training jobs that the tuning job launches. * @return Returns a reference to this object so that method calls can be chained together. */ Builder algorithmSpecification(HyperParameterAlgorithmSpecification algorithmSpecification); /** *

* The HyperParameterAlgorithmSpecification object that specifies the resource algorithm to use for the * training jobs that the tuning job launches. *

* This is a convenience method that creates an instance of the * {@link HyperParameterAlgorithmSpecification.Builder} avoiding the need to create one manually via * {@link HyperParameterAlgorithmSpecification#builder()}. * *

* When the {@link Consumer} completes, {@link HyperParameterAlgorithmSpecification.Builder#build()} is called * immediately and its result is passed to {@link #algorithmSpecification(HyperParameterAlgorithmSpecification)}. * * @param algorithmSpecification * a consumer that will call methods on {@link HyperParameterAlgorithmSpecification.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #algorithmSpecification(HyperParameterAlgorithmSpecification) */ default Builder algorithmSpecification(Consumer algorithmSpecification) { return algorithmSpecification(HyperParameterAlgorithmSpecification.builder().applyMutation(algorithmSpecification) .build()); } /** *

* The Amazon Resource Name (ARN) of the IAM role associated with the training jobs that the tuning job * launches. *

* * @param roleArn * The Amazon Resource Name (ARN) of the IAM role associated with the training jobs that the tuning job * launches. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* An array of Channel * objects that specify the input for the training jobs that the tuning job launches. *

* * @param inputDataConfig * An array of Channel objects * that specify the input for the training jobs that the tuning job launches. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inputDataConfig(Collection inputDataConfig); /** *

* An array of Channel * objects that specify the input for the training jobs that the tuning job launches. *

* * @param inputDataConfig * An array of Channel objects * that specify the input for the training jobs that the tuning job launches. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inputDataConfig(Channel... inputDataConfig); /** *

* An array of Channel * objects that specify the input for the training jobs that the tuning job launches. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.sagemaker.model.Channel.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.sagemaker.model.Channel#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.sagemaker.model.Channel.Builder#build()} is called immediately and its * result is passed to {@link #inputDataConfig(List)}. * * @param inputDataConfig * a consumer that will call methods on * {@link software.amazon.awssdk.services.sagemaker.model.Channel.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #inputDataConfig(java.util.Collection) */ Builder inputDataConfig(Consumer... inputDataConfig); /** *

* The VpcConfig * object that specifies the VPC that you want the training jobs that this hyperparameter tuning job launches to * connect to. Control access to and from your training container by configuring the VPC. For more information, * see Protect Training Jobs by Using * an Amazon Virtual Private Cloud. *

* * @param vpcConfig * The VpcConfig * object that specifies the VPC that you want the training jobs that this hyperparameter tuning job * launches to connect to. Control access to and from your training container by configuring the VPC. For * more information, see Protect * Training Jobs by Using an Amazon Virtual Private Cloud. * @return Returns a reference to this object so that method calls can be chained together. */ Builder vpcConfig(VpcConfig vpcConfig); /** *

* The VpcConfig * object that specifies the VPC that you want the training jobs that this hyperparameter tuning job launches to * connect to. Control access to and from your training container by configuring the VPC. For more information, * see Protect Training Jobs by Using * an Amazon Virtual Private Cloud. *

* This is a convenience method that creates an instance of the {@link VpcConfig.Builder} avoiding the need to * create one manually via {@link VpcConfig#builder()}. * *

* When the {@link Consumer} completes, {@link VpcConfig.Builder#build()} is called immediately and its result * is passed to {@link #vpcConfig(VpcConfig)}. * * @param vpcConfig * a consumer that will call methods on {@link VpcConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #vpcConfig(VpcConfig) */ default Builder vpcConfig(Consumer vpcConfig) { return vpcConfig(VpcConfig.builder().applyMutation(vpcConfig).build()); } /** *

* Specifies the path to the Amazon S3 bucket where you store model artifacts from the training jobs that the * tuning job launches. *

* * @param outputDataConfig * Specifies the path to the Amazon S3 bucket where you store model artifacts from the training jobs that * the tuning job launches. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outputDataConfig(OutputDataConfig outputDataConfig); /** *

* Specifies the path to the Amazon S3 bucket where you store model artifacts from the training jobs that the * tuning job launches. *

* This is a convenience method that creates an instance of the {@link OutputDataConfig.Builder} avoiding the * need to create one manually via {@link OutputDataConfig#builder()}. * *

* When the {@link Consumer} completes, {@link OutputDataConfig.Builder#build()} is called immediately and its * result is passed to {@link #outputDataConfig(OutputDataConfig)}. * * @param outputDataConfig * a consumer that will call methods on {@link OutputDataConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #outputDataConfig(OutputDataConfig) */ default Builder outputDataConfig(Consumer outputDataConfig) { return outputDataConfig(OutputDataConfig.builder().applyMutation(outputDataConfig).build()); } /** *

* The resources, including the compute instances and storage volumes, to use for the training jobs that the * tuning job launches. *

*

* Storage volumes store model artifacts and incremental states. Training algorithms might also use storage * volumes for scratch space. If you want SageMaker to use the storage volume to store the training data, choose * File as the TrainingInputMode in the algorithm specification. For distributed * training algorithms, specify an instance count greater than 1. *

* *

* If you want to use hyperparameter optimization with instance type flexibility, use * HyperParameterTuningResourceConfig instead. *

*
* * @param resourceConfig * The resources, including the compute instances and storage volumes, to use for the training jobs that * the tuning job launches.

*

* Storage volumes store model artifacts and incremental states. Training algorithms might also use * storage volumes for scratch space. If you want SageMaker to use the storage volume to store the * training data, choose File as the TrainingInputMode in the algorithm * specification. For distributed training algorithms, specify an instance count greater than 1. *

* *

* If you want to use hyperparameter optimization with instance type flexibility, use * HyperParameterTuningResourceConfig instead. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceConfig(ResourceConfig resourceConfig); /** *

* The resources, including the compute instances and storage volumes, to use for the training jobs that the * tuning job launches. *

*

* Storage volumes store model artifacts and incremental states. Training algorithms might also use storage * volumes for scratch space. If you want SageMaker to use the storage volume to store the training data, choose * File as the TrainingInputMode in the algorithm specification. For distributed * training algorithms, specify an instance count greater than 1. *

* *

* If you want to use hyperparameter optimization with instance type flexibility, use * HyperParameterTuningResourceConfig instead. *

*
This is a convenience method that creates an instance of the {@link ResourceConfig.Builder} avoiding * the need to create one manually via {@link ResourceConfig#builder()}. * *

* When the {@link Consumer} completes, {@link ResourceConfig.Builder#build()} is called immediately and its * result is passed to {@link #resourceConfig(ResourceConfig)}. * * @param resourceConfig * a consumer that will call methods on {@link ResourceConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #resourceConfig(ResourceConfig) */ default Builder resourceConfig(Consumer resourceConfig) { return resourceConfig(ResourceConfig.builder().applyMutation(resourceConfig).build()); } /** *

* The configuration for the hyperparameter tuning resources, including the compute instances and storage * volumes, used for training jobs launched by the tuning job. By default, storage volumes hold model artifacts * and incremental states. Choose File for TrainingInputMode in the * AlgorithmSpecification parameter to additionally store training data in the storage volume * (optional). *

* * @param hyperParameterTuningResourceConfig * The configuration for the hyperparameter tuning resources, including the compute instances and storage * volumes, used for training jobs launched by the tuning job. By default, storage volumes hold model * artifacts and incremental states. Choose File for TrainingInputMode in the * AlgorithmSpecification parameter to additionally store training data in the storage * volume (optional). * @return Returns a reference to this object so that method calls can be chained together. */ Builder hyperParameterTuningResourceConfig(HyperParameterTuningResourceConfig hyperParameterTuningResourceConfig); /** *

* The configuration for the hyperparameter tuning resources, including the compute instances and storage * volumes, used for training jobs launched by the tuning job. By default, storage volumes hold model artifacts * and incremental states. Choose File for TrainingInputMode in the * AlgorithmSpecification parameter to additionally store training data in the storage volume * (optional). *

* This is a convenience method that creates an instance of the * {@link HyperParameterTuningResourceConfig.Builder} avoiding the need to create one manually via * {@link HyperParameterTuningResourceConfig#builder()}. * *

* When the {@link Consumer} completes, {@link HyperParameterTuningResourceConfig.Builder#build()} is called * immediately and its result is passed to * {@link #hyperParameterTuningResourceConfig(HyperParameterTuningResourceConfig)}. * * @param hyperParameterTuningResourceConfig * a consumer that will call methods on {@link HyperParameterTuningResourceConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #hyperParameterTuningResourceConfig(HyperParameterTuningResourceConfig) */ default Builder hyperParameterTuningResourceConfig( Consumer hyperParameterTuningResourceConfig) { return hyperParameterTuningResourceConfig(HyperParameterTuningResourceConfig.builder() .applyMutation(hyperParameterTuningResourceConfig).build()); } /** *

* Specifies a limit to how long a model hyperparameter training job can run. It also specifies how long a * managed spot training job has to complete. When the job reaches the time limit, SageMaker ends the training * job. Use this API to cap model training costs. *

* * @param stoppingCondition * Specifies a limit to how long a model hyperparameter training job can run. It also specifies how long * a managed spot training job has to complete. When the job reaches the time limit, SageMaker ends the * training job. Use this API to cap model training costs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder stoppingCondition(StoppingCondition stoppingCondition); /** *

* Specifies a limit to how long a model hyperparameter training job can run. It also specifies how long a * managed spot training job has to complete. When the job reaches the time limit, SageMaker ends the training * job. Use this API to cap model training costs. *

* This is a convenience method that creates an instance of the {@link StoppingCondition.Builder} avoiding the * need to create one manually via {@link StoppingCondition#builder()}. * *

* When the {@link Consumer} completes, {@link StoppingCondition.Builder#build()} is called immediately and its * result is passed to {@link #stoppingCondition(StoppingCondition)}. * * @param stoppingCondition * a consumer that will call methods on {@link StoppingCondition.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #stoppingCondition(StoppingCondition) */ default Builder stoppingCondition(Consumer stoppingCondition) { return stoppingCondition(StoppingCondition.builder().applyMutation(stoppingCondition).build()); } /** *

* Isolates the training container. No inbound or outbound network calls can be made, except for calls between * peers within a training cluster for distributed training. If network isolation is used for training jobs that * are configured to use a VPC, SageMaker downloads and uploads customer data and model artifacts through the * specified VPC, but the training container does not have network access. *

* * @param enableNetworkIsolation * Isolates the training container. No inbound or outbound network calls can be made, except for calls * between peers within a training cluster for distributed training. If network isolation is used for * training jobs that are configured to use a VPC, SageMaker downloads and uploads customer data and * model artifacts through the specified VPC, but the training container does not have network access. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableNetworkIsolation(Boolean enableNetworkIsolation); /** *

* To encrypt all communications between ML compute instances in distributed training, choose True. * Encryption provides greater security for distributed training, but training might take longer. How long it * takes depends on the amount of communication between compute instances, especially if you use a deep learning * algorithm in distributed training. *

* * @param enableInterContainerTrafficEncryption * To encrypt all communications between ML compute instances in distributed training, choose * True. Encryption provides greater security for distributed training, but training might * take longer. How long it takes depends on the amount of communication between compute instances, * especially if you use a deep learning algorithm in distributed training. * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableInterContainerTrafficEncryption(Boolean enableInterContainerTrafficEncryption); /** *

* A Boolean indicating whether managed spot training is enabled (True) or not (False * ). *

* * @param enableManagedSpotTraining * A Boolean indicating whether managed spot training is enabled (True) or not ( * False). * @return Returns a reference to this object so that method calls can be chained together. */ Builder enableManagedSpotTraining(Boolean enableManagedSpotTraining); /** * Sets the value of the CheckpointConfig property for this object. * * @param checkpointConfig * The new value for the CheckpointConfig property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder checkpointConfig(CheckpointConfig checkpointConfig); /** * Sets the value of the CheckpointConfig property for this object. * * This is a convenience method that creates an instance of the {@link CheckpointConfig.Builder} avoiding the * need to create one manually via {@link CheckpointConfig#builder()}. * *

* When the {@link Consumer} completes, {@link CheckpointConfig.Builder#build()} is called immediately and its * result is passed to {@link #checkpointConfig(CheckpointConfig)}. * * @param checkpointConfig * a consumer that will call methods on {@link CheckpointConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #checkpointConfig(CheckpointConfig) */ default Builder checkpointConfig(Consumer checkpointConfig) { return checkpointConfig(CheckpointConfig.builder().applyMutation(checkpointConfig).build()); } /** *

* The number of times to retry the job when the job fails due to an InternalServerError. *

* * @param retryStrategy * The number of times to retry the job when the job fails due to an InternalServerError. * @return Returns a reference to this object so that method calls can be chained together. */ Builder retryStrategy(RetryStrategy retryStrategy); /** *

* The number of times to retry the job when the job fails due to an InternalServerError. *

* This is a convenience method that creates an instance of the {@link RetryStrategy.Builder} avoiding the need * to create one manually via {@link RetryStrategy#builder()}. * *

* When the {@link Consumer} completes, {@link RetryStrategy.Builder#build()} is called immediately and its * result is passed to {@link #retryStrategy(RetryStrategy)}. * * @param retryStrategy * a consumer that will call methods on {@link RetryStrategy.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #retryStrategy(RetryStrategy) */ default Builder retryStrategy(Consumer retryStrategy) { return retryStrategy(RetryStrategy.builder().applyMutation(retryStrategy).build()); } /** *

* An environment variable that you can pass into the SageMaker CreateTrainingJob API. You can use an existing environment variable from the training container or use your own. See Define metrics and variables for more information. *

* *

* The maximum number of items specified for Map Entries refers to the maximum number of * environment variables for each TrainingJobDefinition and also the maximum for the hyperparameter * tuning job itself. That is, the sum of the number of environment variables for all the training job * definitions can't exceed the maximum number specified. *

*
* * @param environment * An environment variable that you can pass into the SageMaker CreateTrainingJob API. You can use an existing environment variable from the training container or use your own. See Define metrics and variables for more information.

*

* The maximum number of items specified for Map Entries refers to the maximum number of * environment variables for each TrainingJobDefinition and also the maximum for the * hyperparameter tuning job itself. That is, the sum of the number of environment variables for all the * training job definitions can't exceed the maximum number specified. *

* @return Returns a reference to this object so that method calls can be chained together. */ Builder environment(Map environment); } static final class BuilderImpl implements Builder { private String definitionName; private HyperParameterTuningJobObjective tuningObjective; private ParameterRanges hyperParameterRanges; private Map staticHyperParameters = DefaultSdkAutoConstructMap.getInstance(); private HyperParameterAlgorithmSpecification algorithmSpecification; private String roleArn; private List inputDataConfig = DefaultSdkAutoConstructList.getInstance(); private VpcConfig vpcConfig; private OutputDataConfig outputDataConfig; private ResourceConfig resourceConfig; private HyperParameterTuningResourceConfig hyperParameterTuningResourceConfig; private StoppingCondition stoppingCondition; private Boolean enableNetworkIsolation; private Boolean enableInterContainerTrafficEncryption; private Boolean enableManagedSpotTraining; private CheckpointConfig checkpointConfig; private RetryStrategy retryStrategy; private Map environment = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(HyperParameterTrainingJobDefinition model) { definitionName(model.definitionName); tuningObjective(model.tuningObjective); hyperParameterRanges(model.hyperParameterRanges); staticHyperParameters(model.staticHyperParameters); algorithmSpecification(model.algorithmSpecification); roleArn(model.roleArn); inputDataConfig(model.inputDataConfig); vpcConfig(model.vpcConfig); outputDataConfig(model.outputDataConfig); resourceConfig(model.resourceConfig); hyperParameterTuningResourceConfig(model.hyperParameterTuningResourceConfig); stoppingCondition(model.stoppingCondition); enableNetworkIsolation(model.enableNetworkIsolation); enableInterContainerTrafficEncryption(model.enableInterContainerTrafficEncryption); enableManagedSpotTraining(model.enableManagedSpotTraining); checkpointConfig(model.checkpointConfig); retryStrategy(model.retryStrategy); environment(model.environment); } public final String getDefinitionName() { return definitionName; } public final void setDefinitionName(String definitionName) { this.definitionName = definitionName; } @Override public final Builder definitionName(String definitionName) { this.definitionName = definitionName; return this; } public final HyperParameterTuningJobObjective.Builder getTuningObjective() { return tuningObjective != null ? tuningObjective.toBuilder() : null; } public final void setTuningObjective(HyperParameterTuningJobObjective.BuilderImpl tuningObjective) { this.tuningObjective = tuningObjective != null ? tuningObjective.build() : null; } @Override public final Builder tuningObjective(HyperParameterTuningJobObjective tuningObjective) { this.tuningObjective = tuningObjective; return this; } public final ParameterRanges.Builder getHyperParameterRanges() { return hyperParameterRanges != null ? hyperParameterRanges.toBuilder() : null; } public final void setHyperParameterRanges(ParameterRanges.BuilderImpl hyperParameterRanges) { this.hyperParameterRanges = hyperParameterRanges != null ? hyperParameterRanges.build() : null; } @Override public final Builder hyperParameterRanges(ParameterRanges hyperParameterRanges) { this.hyperParameterRanges = hyperParameterRanges; return this; } public final Map getStaticHyperParameters() { if (staticHyperParameters instanceof SdkAutoConstructMap) { return null; } return staticHyperParameters; } public final void setStaticHyperParameters(Map staticHyperParameters) { this.staticHyperParameters = HyperParametersCopier.copy(staticHyperParameters); } @Override public final Builder staticHyperParameters(Map staticHyperParameters) { this.staticHyperParameters = HyperParametersCopier.copy(staticHyperParameters); return this; } public final HyperParameterAlgorithmSpecification.Builder getAlgorithmSpecification() { return algorithmSpecification != null ? algorithmSpecification.toBuilder() : null; } public final void setAlgorithmSpecification(HyperParameterAlgorithmSpecification.BuilderImpl algorithmSpecification) { this.algorithmSpecification = algorithmSpecification != null ? algorithmSpecification.build() : null; } @Override public final Builder algorithmSpecification(HyperParameterAlgorithmSpecification algorithmSpecification) { this.algorithmSpecification = algorithmSpecification; return this; } public final String getRoleArn() { return roleArn; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final List getInputDataConfig() { List result = InputDataConfigCopier.copyToBuilder(this.inputDataConfig); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setInputDataConfig(Collection inputDataConfig) { this.inputDataConfig = InputDataConfigCopier.copyFromBuilder(inputDataConfig); } @Override public final Builder inputDataConfig(Collection inputDataConfig) { this.inputDataConfig = InputDataConfigCopier.copy(inputDataConfig); return this; } @Override @SafeVarargs public final Builder inputDataConfig(Channel... inputDataConfig) { inputDataConfig(Arrays.asList(inputDataConfig)); return this; } @Override @SafeVarargs public final Builder inputDataConfig(Consumer... inputDataConfig) { inputDataConfig(Stream.of(inputDataConfig).map(c -> Channel.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final VpcConfig.Builder getVpcConfig() { return vpcConfig != null ? vpcConfig.toBuilder() : null; } public final void setVpcConfig(VpcConfig.BuilderImpl vpcConfig) { this.vpcConfig = vpcConfig != null ? vpcConfig.build() : null; } @Override public final Builder vpcConfig(VpcConfig vpcConfig) { this.vpcConfig = vpcConfig; return this; } public final OutputDataConfig.Builder getOutputDataConfig() { return outputDataConfig != null ? outputDataConfig.toBuilder() : null; } public final void setOutputDataConfig(OutputDataConfig.BuilderImpl outputDataConfig) { this.outputDataConfig = outputDataConfig != null ? outputDataConfig.build() : null; } @Override public final Builder outputDataConfig(OutputDataConfig outputDataConfig) { this.outputDataConfig = outputDataConfig; return this; } public final ResourceConfig.Builder getResourceConfig() { return resourceConfig != null ? resourceConfig.toBuilder() : null; } public final void setResourceConfig(ResourceConfig.BuilderImpl resourceConfig) { this.resourceConfig = resourceConfig != null ? resourceConfig.build() : null; } @Override public final Builder resourceConfig(ResourceConfig resourceConfig) { this.resourceConfig = resourceConfig; return this; } public final HyperParameterTuningResourceConfig.Builder getHyperParameterTuningResourceConfig() { return hyperParameterTuningResourceConfig != null ? hyperParameterTuningResourceConfig.toBuilder() : null; } public final void setHyperParameterTuningResourceConfig( HyperParameterTuningResourceConfig.BuilderImpl hyperParameterTuningResourceConfig) { this.hyperParameterTuningResourceConfig = hyperParameterTuningResourceConfig != null ? hyperParameterTuningResourceConfig .build() : null; } @Override public final Builder hyperParameterTuningResourceConfig( HyperParameterTuningResourceConfig hyperParameterTuningResourceConfig) { this.hyperParameterTuningResourceConfig = hyperParameterTuningResourceConfig; return this; } public final StoppingCondition.Builder getStoppingCondition() { return stoppingCondition != null ? stoppingCondition.toBuilder() : null; } public final void setStoppingCondition(StoppingCondition.BuilderImpl stoppingCondition) { this.stoppingCondition = stoppingCondition != null ? stoppingCondition.build() : null; } @Override public final Builder stoppingCondition(StoppingCondition stoppingCondition) { this.stoppingCondition = stoppingCondition; return this; } public final Boolean getEnableNetworkIsolation() { return enableNetworkIsolation; } public final void setEnableNetworkIsolation(Boolean enableNetworkIsolation) { this.enableNetworkIsolation = enableNetworkIsolation; } @Override public final Builder enableNetworkIsolation(Boolean enableNetworkIsolation) { this.enableNetworkIsolation = enableNetworkIsolation; return this; } public final Boolean getEnableInterContainerTrafficEncryption() { return enableInterContainerTrafficEncryption; } public final void setEnableInterContainerTrafficEncryption(Boolean enableInterContainerTrafficEncryption) { this.enableInterContainerTrafficEncryption = enableInterContainerTrafficEncryption; } @Override public final Builder enableInterContainerTrafficEncryption(Boolean enableInterContainerTrafficEncryption) { this.enableInterContainerTrafficEncryption = enableInterContainerTrafficEncryption; return this; } public final Boolean getEnableManagedSpotTraining() { return enableManagedSpotTraining; } public final void setEnableManagedSpotTraining(Boolean enableManagedSpotTraining) { this.enableManagedSpotTraining = enableManagedSpotTraining; } @Override public final Builder enableManagedSpotTraining(Boolean enableManagedSpotTraining) { this.enableManagedSpotTraining = enableManagedSpotTraining; return this; } public final CheckpointConfig.Builder getCheckpointConfig() { return checkpointConfig != null ? checkpointConfig.toBuilder() : null; } public final void setCheckpointConfig(CheckpointConfig.BuilderImpl checkpointConfig) { this.checkpointConfig = checkpointConfig != null ? checkpointConfig.build() : null; } @Override public final Builder checkpointConfig(CheckpointConfig checkpointConfig) { this.checkpointConfig = checkpointConfig; return this; } public final RetryStrategy.Builder getRetryStrategy() { return retryStrategy != null ? retryStrategy.toBuilder() : null; } public final void setRetryStrategy(RetryStrategy.BuilderImpl retryStrategy) { this.retryStrategy = retryStrategy != null ? retryStrategy.build() : null; } @Override public final Builder retryStrategy(RetryStrategy retryStrategy) { this.retryStrategy = retryStrategy; return this; } public final Map getEnvironment() { if (environment instanceof SdkAutoConstructMap) { return null; } return environment; } public final void setEnvironment(Map environment) { this.environment = HyperParameterTrainingJobEnvironmentMapCopier.copy(environment); } @Override public final Builder environment(Map environment) { this.environment = HyperParameterTrainingJobEnvironmentMapCopier.copy(environment); return this; } @Override public HyperParameterTrainingJobDefinition build() { return new HyperParameterTrainingJobDefinition(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy