
com.amazonaws.services.sagemaker.model.TrainingSpecification Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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 com.amazonaws.services.sagemaker.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Defines how the algorithm is used for a training job.
*
*
* @see AWS
* API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TrainingSpecification implements Serializable, Cloneable, StructuredPojo {
/**
*
* The Amazon ECR registry path of the Docker image that contains the training algorithm.
*
*/
private String trainingImage;
/**
*
* An MD5 hash of the training algorithm that identifies the Docker image used for training.
*
*/
private String trainingImageDigest;
/**
*
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters. This
* is required if the algorithm supports automatic model tuning.>
*
*/
private java.util.List supportedHyperParameters;
/**
*
* A list of the instance types that this algorithm can use for training.
*
*/
private java.util.List supportedTrainingInstanceTypes;
/**
*
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more than
* one instance during training.
*
*/
private Boolean supportsDistributedTraining;
/**
*
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the algorithm.
*
*/
private java.util.List metricDefinitions;
/**
*
* A list of ChannelSpecification
objects, which specify the input sources to be used by the algorithm.
*
*/
private java.util.List trainingChannels;
/**
*
* A list of the metrics that the algorithm emits that can be used as the objective metric in a hyperparameter
* tuning job.
*
*/
private java.util.List supportedTuningJobObjectiveMetrics;
/**
*
* The Amazon ECR registry path of the Docker image that contains the training algorithm.
*
*
* @param trainingImage
* The Amazon ECR registry path of the Docker image that contains the training algorithm.
*/
public void setTrainingImage(String trainingImage) {
this.trainingImage = trainingImage;
}
/**
*
* The Amazon ECR registry path of the Docker image that contains the training algorithm.
*
*
* @return The Amazon ECR registry path of the Docker image that contains the training algorithm.
*/
public String getTrainingImage() {
return this.trainingImage;
}
/**
*
* The Amazon ECR registry path of the Docker image that contains the training algorithm.
*
*
* @param trainingImage
* The Amazon ECR registry path of the Docker image that contains the training algorithm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withTrainingImage(String trainingImage) {
setTrainingImage(trainingImage);
return this;
}
/**
*
* An MD5 hash of the training algorithm that identifies the Docker image used for training.
*
*
* @param trainingImageDigest
* An MD5 hash of the training algorithm that identifies the Docker image used for training.
*/
public void setTrainingImageDigest(String trainingImageDigest) {
this.trainingImageDigest = trainingImageDigest;
}
/**
*
* An MD5 hash of the training algorithm that identifies the Docker image used for training.
*
*
* @return An MD5 hash of the training algorithm that identifies the Docker image used for training.
*/
public String getTrainingImageDigest() {
return this.trainingImageDigest;
}
/**
*
* An MD5 hash of the training algorithm that identifies the Docker image used for training.
*
*
* @param trainingImageDigest
* An MD5 hash of the training algorithm that identifies the Docker image used for training.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withTrainingImageDigest(String trainingImageDigest) {
setTrainingImageDigest(trainingImageDigest);
return this;
}
/**
*
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters. This
* is required if the algorithm supports automatic model tuning.>
*
*
* @return A list of the HyperParameterSpecification
objects, that define the supported
* hyperparameters. This is required if the algorithm supports automatic model tuning.>
*/
public java.util.List getSupportedHyperParameters() {
return supportedHyperParameters;
}
/**
*
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters. This
* is required if the algorithm supports automatic model tuning.>
*
*
* @param supportedHyperParameters
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters.
* This is required if the algorithm supports automatic model tuning.>
*/
public void setSupportedHyperParameters(java.util.Collection supportedHyperParameters) {
if (supportedHyperParameters == null) {
this.supportedHyperParameters = null;
return;
}
this.supportedHyperParameters = new java.util.ArrayList(supportedHyperParameters);
}
/**
*
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters. This
* is required if the algorithm supports automatic model tuning.>
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSupportedHyperParameters(java.util.Collection)} or
* {@link #withSupportedHyperParameters(java.util.Collection)} if you want to override the existing values.
*
*
* @param supportedHyperParameters
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters.
* This is required if the algorithm supports automatic model tuning.>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withSupportedHyperParameters(HyperParameterSpecification... supportedHyperParameters) {
if (this.supportedHyperParameters == null) {
setSupportedHyperParameters(new java.util.ArrayList(supportedHyperParameters.length));
}
for (HyperParameterSpecification ele : supportedHyperParameters) {
this.supportedHyperParameters.add(ele);
}
return this;
}
/**
*
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters. This
* is required if the algorithm supports automatic model tuning.>
*
*
* @param supportedHyperParameters
* A list of the HyperParameterSpecification
objects, that define the supported hyperparameters.
* This is required if the algorithm supports automatic model tuning.>
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withSupportedHyperParameters(java.util.Collection supportedHyperParameters) {
setSupportedHyperParameters(supportedHyperParameters);
return this;
}
/**
*
* A list of the instance types that this algorithm can use for training.
*
*
* @return A list of the instance types that this algorithm can use for training.
* @see TrainingInstanceType
*/
public java.util.List getSupportedTrainingInstanceTypes() {
return supportedTrainingInstanceTypes;
}
/**
*
* A list of the instance types that this algorithm can use for training.
*
*
* @param supportedTrainingInstanceTypes
* A list of the instance types that this algorithm can use for training.
* @see TrainingInstanceType
*/
public void setSupportedTrainingInstanceTypes(java.util.Collection supportedTrainingInstanceTypes) {
if (supportedTrainingInstanceTypes == null) {
this.supportedTrainingInstanceTypes = null;
return;
}
this.supportedTrainingInstanceTypes = new java.util.ArrayList(supportedTrainingInstanceTypes);
}
/**
*
* A list of the instance types that this algorithm can use for training.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSupportedTrainingInstanceTypes(java.util.Collection)} or
* {@link #withSupportedTrainingInstanceTypes(java.util.Collection)} if you want to override the existing values.
*
*
* @param supportedTrainingInstanceTypes
* A list of the instance types that this algorithm can use for training.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TrainingInstanceType
*/
public TrainingSpecification withSupportedTrainingInstanceTypes(String... supportedTrainingInstanceTypes) {
if (this.supportedTrainingInstanceTypes == null) {
setSupportedTrainingInstanceTypes(new java.util.ArrayList(supportedTrainingInstanceTypes.length));
}
for (String ele : supportedTrainingInstanceTypes) {
this.supportedTrainingInstanceTypes.add(ele);
}
return this;
}
/**
*
* A list of the instance types that this algorithm can use for training.
*
*
* @param supportedTrainingInstanceTypes
* A list of the instance types that this algorithm can use for training.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TrainingInstanceType
*/
public TrainingSpecification withSupportedTrainingInstanceTypes(java.util.Collection supportedTrainingInstanceTypes) {
setSupportedTrainingInstanceTypes(supportedTrainingInstanceTypes);
return this;
}
/**
*
* A list of the instance types that this algorithm can use for training.
*
*
* @param supportedTrainingInstanceTypes
* A list of the instance types that this algorithm can use for training.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TrainingInstanceType
*/
public TrainingSpecification withSupportedTrainingInstanceTypes(TrainingInstanceType... supportedTrainingInstanceTypes) {
java.util.ArrayList supportedTrainingInstanceTypesCopy = new java.util.ArrayList(supportedTrainingInstanceTypes.length);
for (TrainingInstanceType value : supportedTrainingInstanceTypes) {
supportedTrainingInstanceTypesCopy.add(value.toString());
}
if (getSupportedTrainingInstanceTypes() == null) {
setSupportedTrainingInstanceTypes(supportedTrainingInstanceTypesCopy);
} else {
getSupportedTrainingInstanceTypes().addAll(supportedTrainingInstanceTypesCopy);
}
return this;
}
/**
*
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more than
* one instance during training.
*
*
* @param supportsDistributedTraining
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more
* than one instance during training.
*/
public void setSupportsDistributedTraining(Boolean supportsDistributedTraining) {
this.supportsDistributedTraining = supportsDistributedTraining;
}
/**
*
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more than
* one instance during training.
*
*
* @return Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more
* than one instance during training.
*/
public Boolean getSupportsDistributedTraining() {
return this.supportsDistributedTraining;
}
/**
*
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more than
* one instance during training.
*
*
* @param supportsDistributedTraining
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more
* than one instance during training.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withSupportsDistributedTraining(Boolean supportsDistributedTraining) {
setSupportsDistributedTraining(supportsDistributedTraining);
return this;
}
/**
*
* Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more than
* one instance during training.
*
*
* @return Indicates whether the algorithm supports distributed training. If set to false, buyers can't request more
* than one instance during training.
*/
public Boolean isSupportsDistributedTraining() {
return this.supportsDistributedTraining;
}
/**
*
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the algorithm.
*
*
* @return A list of MetricDefinition
objects, which are used for parsing metrics generated by the
* algorithm.
*/
public java.util.List getMetricDefinitions() {
return metricDefinitions;
}
/**
*
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the algorithm.
*
*
* @param metricDefinitions
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the
* algorithm.
*/
public void setMetricDefinitions(java.util.Collection metricDefinitions) {
if (metricDefinitions == null) {
this.metricDefinitions = null;
return;
}
this.metricDefinitions = new java.util.ArrayList(metricDefinitions);
}
/**
*
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the algorithm.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setMetricDefinitions(java.util.Collection)} or {@link #withMetricDefinitions(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param metricDefinitions
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the
* algorithm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withMetricDefinitions(MetricDefinition... metricDefinitions) {
if (this.metricDefinitions == null) {
setMetricDefinitions(new java.util.ArrayList(metricDefinitions.length));
}
for (MetricDefinition ele : metricDefinitions) {
this.metricDefinitions.add(ele);
}
return this;
}
/**
*
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the algorithm.
*
*
* @param metricDefinitions
* A list of MetricDefinition
objects, which are used for parsing metrics generated by the
* algorithm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withMetricDefinitions(java.util.Collection metricDefinitions) {
setMetricDefinitions(metricDefinitions);
return this;
}
/**
*
* A list of ChannelSpecification
objects, which specify the input sources to be used by the algorithm.
*
*
* @return A list of ChannelSpecification
objects, which specify the input sources to be used by the
* algorithm.
*/
public java.util.List getTrainingChannels() {
return trainingChannels;
}
/**
*
* A list of ChannelSpecification
objects, which specify the input sources to be used by the algorithm.
*
*
* @param trainingChannels
* A list of ChannelSpecification
objects, which specify the input sources to be used by the
* algorithm.
*/
public void setTrainingChannels(java.util.Collection trainingChannels) {
if (trainingChannels == null) {
this.trainingChannels = null;
return;
}
this.trainingChannels = new java.util.ArrayList(trainingChannels);
}
/**
*
* A list of ChannelSpecification
objects, which specify the input sources to be used by the algorithm.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTrainingChannels(java.util.Collection)} or {@link #withTrainingChannels(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param trainingChannels
* A list of ChannelSpecification
objects, which specify the input sources to be used by the
* algorithm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withTrainingChannels(ChannelSpecification... trainingChannels) {
if (this.trainingChannels == null) {
setTrainingChannels(new java.util.ArrayList(trainingChannels.length));
}
for (ChannelSpecification ele : trainingChannels) {
this.trainingChannels.add(ele);
}
return this;
}
/**
*
* A list of ChannelSpecification
objects, which specify the input sources to be used by the algorithm.
*
*
* @param trainingChannels
* A list of ChannelSpecification
objects, which specify the input sources to be used by the
* algorithm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withTrainingChannels(java.util.Collection trainingChannels) {
setTrainingChannels(trainingChannels);
return this;
}
/**
*
* A list of the metrics that the algorithm emits that can be used as the objective metric in a hyperparameter
* tuning job.
*
*
* @return A list of the metrics that the algorithm emits that can be used as the objective metric in a
* hyperparameter tuning job.
*/
public java.util.List getSupportedTuningJobObjectiveMetrics() {
return supportedTuningJobObjectiveMetrics;
}
/**
*
* A list of the metrics that the algorithm emits that can be used as the objective metric in a hyperparameter
* tuning job.
*
*
* @param supportedTuningJobObjectiveMetrics
* A list of the metrics that the algorithm emits that can be used as the objective metric in a
* hyperparameter tuning job.
*/
public void setSupportedTuningJobObjectiveMetrics(java.util.Collection supportedTuningJobObjectiveMetrics) {
if (supportedTuningJobObjectiveMetrics == null) {
this.supportedTuningJobObjectiveMetrics = null;
return;
}
this.supportedTuningJobObjectiveMetrics = new java.util.ArrayList(supportedTuningJobObjectiveMetrics);
}
/**
*
* A list of the metrics that the algorithm emits that can be used as the objective metric in a hyperparameter
* tuning job.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSupportedTuningJobObjectiveMetrics(java.util.Collection)} or
* {@link #withSupportedTuningJobObjectiveMetrics(java.util.Collection)} if you want to override the existing
* values.
*
*
* @param supportedTuningJobObjectiveMetrics
* A list of the metrics that the algorithm emits that can be used as the objective metric in a
* hyperparameter tuning job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withSupportedTuningJobObjectiveMetrics(HyperParameterTuningJobObjective... supportedTuningJobObjectiveMetrics) {
if (this.supportedTuningJobObjectiveMetrics == null) {
setSupportedTuningJobObjectiveMetrics(new java.util.ArrayList(supportedTuningJobObjectiveMetrics.length));
}
for (HyperParameterTuningJobObjective ele : supportedTuningJobObjectiveMetrics) {
this.supportedTuningJobObjectiveMetrics.add(ele);
}
return this;
}
/**
*
* A list of the metrics that the algorithm emits that can be used as the objective metric in a hyperparameter
* tuning job.
*
*
* @param supportedTuningJobObjectiveMetrics
* A list of the metrics that the algorithm emits that can be used as the objective metric in a
* hyperparameter tuning job.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TrainingSpecification withSupportedTuningJobObjectiveMetrics(
java.util.Collection supportedTuningJobObjectiveMetrics) {
setSupportedTuningJobObjectiveMetrics(supportedTuningJobObjectiveMetrics);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getTrainingImage() != null)
sb.append("TrainingImage: ").append(getTrainingImage()).append(",");
if (getTrainingImageDigest() != null)
sb.append("TrainingImageDigest: ").append(getTrainingImageDigest()).append(",");
if (getSupportedHyperParameters() != null)
sb.append("SupportedHyperParameters: ").append(getSupportedHyperParameters()).append(",");
if (getSupportedTrainingInstanceTypes() != null)
sb.append("SupportedTrainingInstanceTypes: ").append(getSupportedTrainingInstanceTypes()).append(",");
if (getSupportsDistributedTraining() != null)
sb.append("SupportsDistributedTraining: ").append(getSupportsDistributedTraining()).append(",");
if (getMetricDefinitions() != null)
sb.append("MetricDefinitions: ").append(getMetricDefinitions()).append(",");
if (getTrainingChannels() != null)
sb.append("TrainingChannels: ").append(getTrainingChannels()).append(",");
if (getSupportedTuningJobObjectiveMetrics() != null)
sb.append("SupportedTuningJobObjectiveMetrics: ").append(getSupportedTuningJobObjectiveMetrics());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TrainingSpecification == false)
return false;
TrainingSpecification other = (TrainingSpecification) obj;
if (other.getTrainingImage() == null ^ this.getTrainingImage() == null)
return false;
if (other.getTrainingImage() != null && other.getTrainingImage().equals(this.getTrainingImage()) == false)
return false;
if (other.getTrainingImageDigest() == null ^ this.getTrainingImageDigest() == null)
return false;
if (other.getTrainingImageDigest() != null && other.getTrainingImageDigest().equals(this.getTrainingImageDigest()) == false)
return false;
if (other.getSupportedHyperParameters() == null ^ this.getSupportedHyperParameters() == null)
return false;
if (other.getSupportedHyperParameters() != null && other.getSupportedHyperParameters().equals(this.getSupportedHyperParameters()) == false)
return false;
if (other.getSupportedTrainingInstanceTypes() == null ^ this.getSupportedTrainingInstanceTypes() == null)
return false;
if (other.getSupportedTrainingInstanceTypes() != null
&& other.getSupportedTrainingInstanceTypes().equals(this.getSupportedTrainingInstanceTypes()) == false)
return false;
if (other.getSupportsDistributedTraining() == null ^ this.getSupportsDistributedTraining() == null)
return false;
if (other.getSupportsDistributedTraining() != null && other.getSupportsDistributedTraining().equals(this.getSupportsDistributedTraining()) == false)
return false;
if (other.getMetricDefinitions() == null ^ this.getMetricDefinitions() == null)
return false;
if (other.getMetricDefinitions() != null && other.getMetricDefinitions().equals(this.getMetricDefinitions()) == false)
return false;
if (other.getTrainingChannels() == null ^ this.getTrainingChannels() == null)
return false;
if (other.getTrainingChannels() != null && other.getTrainingChannels().equals(this.getTrainingChannels()) == false)
return false;
if (other.getSupportedTuningJobObjectiveMetrics() == null ^ this.getSupportedTuningJobObjectiveMetrics() == null)
return false;
if (other.getSupportedTuningJobObjectiveMetrics() != null
&& other.getSupportedTuningJobObjectiveMetrics().equals(this.getSupportedTuningJobObjectiveMetrics()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTrainingImage() == null) ? 0 : getTrainingImage().hashCode());
hashCode = prime * hashCode + ((getTrainingImageDigest() == null) ? 0 : getTrainingImageDigest().hashCode());
hashCode = prime * hashCode + ((getSupportedHyperParameters() == null) ? 0 : getSupportedHyperParameters().hashCode());
hashCode = prime * hashCode + ((getSupportedTrainingInstanceTypes() == null) ? 0 : getSupportedTrainingInstanceTypes().hashCode());
hashCode = prime * hashCode + ((getSupportsDistributedTraining() == null) ? 0 : getSupportsDistributedTraining().hashCode());
hashCode = prime * hashCode + ((getMetricDefinitions() == null) ? 0 : getMetricDefinitions().hashCode());
hashCode = prime * hashCode + ((getTrainingChannels() == null) ? 0 : getTrainingChannels().hashCode());
hashCode = prime * hashCode + ((getSupportedTuningJobObjectiveMetrics() == null) ? 0 : getSupportedTuningJobObjectiveMetrics().hashCode());
return hashCode;
}
@Override
public TrainingSpecification clone() {
try {
return (TrainingSpecification) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.sagemaker.model.transform.TrainingSpecificationMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}