
software.amazon.awssdk.services.sagemaker.model.HyperParameterTuningJobSummary Maven / Gradle / Ivy
/*
* 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.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Provides summary information about a hyperparameter tuning job.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class HyperParameterTuningJobSummary implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField HYPER_PARAMETER_TUNING_JOB_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("HyperParameterTuningJobName")
.getter(getter(HyperParameterTuningJobSummary::hyperParameterTuningJobName))
.setter(setter(Builder::hyperParameterTuningJobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HyperParameterTuningJobName")
.build()).build();
private static final SdkField HYPER_PARAMETER_TUNING_JOB_ARN_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("HyperParameterTuningJobArn")
.getter(getter(HyperParameterTuningJobSummary::hyperParameterTuningJobArn))
.setter(setter(Builder::hyperParameterTuningJobArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HyperParameterTuningJobArn").build())
.build();
private static final SdkField HYPER_PARAMETER_TUNING_JOB_STATUS_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("HyperParameterTuningJobStatus")
.getter(getter(HyperParameterTuningJobSummary::hyperParameterTuningJobStatusAsString))
.setter(setter(Builder::hyperParameterTuningJobStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HyperParameterTuningJobStatus")
.build()).build();
private static final SdkField STRATEGY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Strategy").getter(getter(HyperParameterTuningJobSummary::strategyAsString))
.setter(setter(Builder::strategy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Strategy").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(HyperParameterTuningJobSummary::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField HYPER_PARAMETER_TUNING_END_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("HyperParameterTuningEndTime")
.getter(getter(HyperParameterTuningJobSummary::hyperParameterTuningEndTime))
.setter(setter(Builder::hyperParameterTuningEndTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HyperParameterTuningEndTime")
.build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModifiedTime").getter(getter(HyperParameterTuningJobSummary::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final SdkField TRAINING_JOB_STATUS_COUNTERS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TrainingJobStatusCounters")
.getter(getter(HyperParameterTuningJobSummary::trainingJobStatusCounters))
.setter(setter(Builder::trainingJobStatusCounters)).constructor(TrainingJobStatusCounters::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TrainingJobStatusCounters").build())
.build();
private static final SdkField OBJECTIVE_STATUS_COUNTERS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ObjectiveStatusCounters")
.getter(getter(HyperParameterTuningJobSummary::objectiveStatusCounters))
.setter(setter(Builder::objectiveStatusCounters)).constructor(ObjectiveStatusCounters::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ObjectiveStatusCounters").build())
.build();
private static final SdkField RESOURCE_LIMITS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ResourceLimits")
.getter(getter(HyperParameterTuningJobSummary::resourceLimits)).setter(setter(Builder::resourceLimits))
.constructor(ResourceLimits::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceLimits").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
HYPER_PARAMETER_TUNING_JOB_NAME_FIELD, HYPER_PARAMETER_TUNING_JOB_ARN_FIELD, HYPER_PARAMETER_TUNING_JOB_STATUS_FIELD,
STRATEGY_FIELD, CREATION_TIME_FIELD, HYPER_PARAMETER_TUNING_END_TIME_FIELD, LAST_MODIFIED_TIME_FIELD,
TRAINING_JOB_STATUS_COUNTERS_FIELD, OBJECTIVE_STATUS_COUNTERS_FIELD, RESOURCE_LIMITS_FIELD));
private static final long serialVersionUID = 1L;
private final String hyperParameterTuningJobName;
private final String hyperParameterTuningJobArn;
private final String hyperParameterTuningJobStatus;
private final String strategy;
private final Instant creationTime;
private final Instant hyperParameterTuningEndTime;
private final Instant lastModifiedTime;
private final TrainingJobStatusCounters trainingJobStatusCounters;
private final ObjectiveStatusCounters objectiveStatusCounters;
private final ResourceLimits resourceLimits;
private HyperParameterTuningJobSummary(BuilderImpl builder) {
this.hyperParameterTuningJobName = builder.hyperParameterTuningJobName;
this.hyperParameterTuningJobArn = builder.hyperParameterTuningJobArn;
this.hyperParameterTuningJobStatus = builder.hyperParameterTuningJobStatus;
this.strategy = builder.strategy;
this.creationTime = builder.creationTime;
this.hyperParameterTuningEndTime = builder.hyperParameterTuningEndTime;
this.lastModifiedTime = builder.lastModifiedTime;
this.trainingJobStatusCounters = builder.trainingJobStatusCounters;
this.objectiveStatusCounters = builder.objectiveStatusCounters;
this.resourceLimits = builder.resourceLimits;
}
/**
*
* The name of the tuning job.
*
*
* @return The name of the tuning job.
*/
public String hyperParameterTuningJobName() {
return hyperParameterTuningJobName;
}
/**
*
* The Amazon Resource Name (ARN) of the tuning job.
*
*
* @return The Amazon Resource Name (ARN) of the tuning job.
*/
public String hyperParameterTuningJobArn() {
return hyperParameterTuningJobArn;
}
/**
*
* The status of the tuning job.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #hyperParameterTuningJobStatus} will return {@link HyperParameterTuningJobStatus#UNKNOWN_TO_SDK_VERSION}.
* The raw value returned by the service is available from {@link #hyperParameterTuningJobStatusAsString}.
*
*
* @return The status of the tuning job.
* @see HyperParameterTuningJobStatus
*/
public HyperParameterTuningJobStatus hyperParameterTuningJobStatus() {
return HyperParameterTuningJobStatus.fromValue(hyperParameterTuningJobStatus);
}
/**
*
* The status of the tuning job.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #hyperParameterTuningJobStatus} will return {@link HyperParameterTuningJobStatus#UNKNOWN_TO_SDK_VERSION}.
* The raw value returned by the service is available from {@link #hyperParameterTuningJobStatusAsString}.
*
*
* @return The status of the tuning job.
* @see HyperParameterTuningJobStatus
*/
public String hyperParameterTuningJobStatusAsString() {
return hyperParameterTuningJobStatus;
}
/**
*
* Specifies the search strategy hyperparameter tuning uses to choose which hyperparameters to use for each
* iteration. Currently, the only valid value is Bayesian.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #strategy} will
* return {@link HyperParameterTuningJobStrategyType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #strategyAsString}.
*
*
* @return Specifies the search strategy hyperparameter tuning uses to choose which hyperparameters to use for each
* iteration. Currently, the only valid value is Bayesian.
* @see HyperParameterTuningJobStrategyType
*/
public HyperParameterTuningJobStrategyType strategy() {
return HyperParameterTuningJobStrategyType.fromValue(strategy);
}
/**
*
* Specifies the search strategy hyperparameter tuning uses to choose which hyperparameters to use for each
* iteration. Currently, the only valid value is Bayesian.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #strategy} will
* return {@link HyperParameterTuningJobStrategyType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service
* is available from {@link #strategyAsString}.
*
*
* @return Specifies the search strategy hyperparameter tuning uses to choose which hyperparameters to use for each
* iteration. Currently, the only valid value is Bayesian.
* @see HyperParameterTuningJobStrategyType
*/
public String strategyAsString() {
return strategy;
}
/**
*
* The date and time that the tuning job was created.
*
*
* @return The date and time that the tuning job was created.
*/
public Instant creationTime() {
return creationTime;
}
/**
*
* The date and time that the tuning job ended.
*
*
* @return The date and time that the tuning job ended.
*/
public Instant hyperParameterTuningEndTime() {
return hyperParameterTuningEndTime;
}
/**
*
* The date and time that the tuning job was modified.
*
*
* @return The date and time that the tuning job was modified.
*/
public Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
*
* The TrainingJobStatusCounters object that specifies the numbers of training jobs, categorized by status,
* that this tuning job launched.
*
*
* @return The TrainingJobStatusCounters object that specifies the numbers of training jobs, categorized by
* status, that this tuning job launched.
*/
public TrainingJobStatusCounters trainingJobStatusCounters() {
return trainingJobStatusCounters;
}
/**
*
* The ObjectiveStatusCounters object that specifies the numbers of training jobs, categorized by objective
* metric status, that this tuning job launched.
*
*
* @return The ObjectiveStatusCounters object that specifies the numbers of training jobs, categorized by
* objective metric status, that this tuning job launched.
*/
public ObjectiveStatusCounters objectiveStatusCounters() {
return objectiveStatusCounters;
}
/**
*
* The ResourceLimits object that specifies the maximum number of training jobs and parallel training jobs
* allowed for this tuning job.
*
*
* @return The ResourceLimits object that specifies the maximum number of training jobs and parallel training
* jobs allowed for this tuning job.
*/
public ResourceLimits resourceLimits() {
return resourceLimits;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(hyperParameterTuningJobName());
hashCode = 31 * hashCode + Objects.hashCode(hyperParameterTuningJobArn());
hashCode = 31 * hashCode + Objects.hashCode(hyperParameterTuningJobStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(strategyAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(hyperParameterTuningEndTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(trainingJobStatusCounters());
hashCode = 31 * hashCode + Objects.hashCode(objectiveStatusCounters());
hashCode = 31 * hashCode + Objects.hashCode(resourceLimits());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof HyperParameterTuningJobSummary)) {
return false;
}
HyperParameterTuningJobSummary other = (HyperParameterTuningJobSummary) obj;
return Objects.equals(hyperParameterTuningJobName(), other.hyperParameterTuningJobName())
&& Objects.equals(hyperParameterTuningJobArn(), other.hyperParameterTuningJobArn())
&& Objects.equals(hyperParameterTuningJobStatusAsString(), other.hyperParameterTuningJobStatusAsString())
&& Objects.equals(strategyAsString(), other.strategyAsString())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(hyperParameterTuningEndTime(), other.hyperParameterTuningEndTime())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime())
&& Objects.equals(trainingJobStatusCounters(), other.trainingJobStatusCounters())
&& Objects.equals(objectiveStatusCounters(), other.objectiveStatusCounters())
&& Objects.equals(resourceLimits(), other.resourceLimits());
}
/**
* 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 String toString() {
return ToString.builder("HyperParameterTuningJobSummary")
.add("HyperParameterTuningJobName", hyperParameterTuningJobName())
.add("HyperParameterTuningJobArn", hyperParameterTuningJobArn())
.add("HyperParameterTuningJobStatus", hyperParameterTuningJobStatusAsString())
.add("Strategy", strategyAsString()).add("CreationTime", creationTime())
.add("HyperParameterTuningEndTime", hyperParameterTuningEndTime()).add("LastModifiedTime", lastModifiedTime())
.add("TrainingJobStatusCounters", trainingJobStatusCounters())
.add("ObjectiveStatusCounters", objectiveStatusCounters()).add("ResourceLimits", resourceLimits()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "HyperParameterTuningJobName":
return Optional.ofNullable(clazz.cast(hyperParameterTuningJobName()));
case "HyperParameterTuningJobArn":
return Optional.ofNullable(clazz.cast(hyperParameterTuningJobArn()));
case "HyperParameterTuningJobStatus":
return Optional.ofNullable(clazz.cast(hyperParameterTuningJobStatusAsString()));
case "Strategy":
return Optional.ofNullable(clazz.cast(strategyAsString()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "HyperParameterTuningEndTime":
return Optional.ofNullable(clazz.cast(hyperParameterTuningEndTime()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "TrainingJobStatusCounters":
return Optional.ofNullable(clazz.cast(trainingJobStatusCounters()));
case "ObjectiveStatusCounters":
return Optional.ofNullable(clazz.cast(objectiveStatusCounters()));
case "ResourceLimits":
return Optional.ofNullable(clazz.cast(resourceLimits()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function