
software.amazon.awssdk.services.personalize.model.DefaultContinuousHyperParameterRange Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.personalize.model;
import java.io.Serializable;
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.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 the name and default range of a continuous hyperparameter and whether the hyperparameter is tunable. A
* tunable hyperparameter can have its value determined during hyperparameter optimization (HPO).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DefaultContinuousHyperParameterRange implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DefaultContinuousHyperParameterRange::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField MIN_VALUE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(DefaultContinuousHyperParameterRange::minValue)).setter(setter(Builder::minValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("minValue").build()).build();
private static final SdkField MAX_VALUE_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.getter(getter(DefaultContinuousHyperParameterRange::maxValue)).setter(setter(Builder::maxValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("maxValue").build()).build();
private static final SdkField IS_TUNABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(DefaultContinuousHyperParameterRange::isTunable)).setter(setter(Builder::isTunable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isTunable").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, MIN_VALUE_FIELD,
MAX_VALUE_FIELD, IS_TUNABLE_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final Double minValue;
private final Double maxValue;
private final Boolean isTunable;
private DefaultContinuousHyperParameterRange(BuilderImpl builder) {
this.name = builder.name;
this.minValue = builder.minValue;
this.maxValue = builder.maxValue;
this.isTunable = builder.isTunable;
}
/**
*
* The name of the hyperparameter.
*
*
* @return The name of the hyperparameter.
*/
public String name() {
return name;
}
/**
*
* The minimum allowable value for the hyperparameter.
*
*
* @return The minimum allowable value for the hyperparameter.
*/
public Double minValue() {
return minValue;
}
/**
*
* The maximum allowable value for the hyperparameter.
*
*
* @return The maximum allowable value for the hyperparameter.
*/
public Double maxValue() {
return maxValue;
}
/**
*
* Whether the hyperparameter is tunable.
*
*
* @return Whether the hyperparameter is tunable.
*/
public Boolean isTunable() {
return isTunable;
}
@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(name());
hashCode = 31 * hashCode + Objects.hashCode(minValue());
hashCode = 31 * hashCode + Objects.hashCode(maxValue());
hashCode = 31 * hashCode + Objects.hashCode(isTunable());
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 DefaultContinuousHyperParameterRange)) {
return false;
}
DefaultContinuousHyperParameterRange other = (DefaultContinuousHyperParameterRange) obj;
return Objects.equals(name(), other.name()) && Objects.equals(minValue(), other.minValue())
&& Objects.equals(maxValue(), other.maxValue()) && Objects.equals(isTunable(), other.isTunable());
}
/**
* 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("DefaultContinuousHyperParameterRange").add("Name", name()).add("MinValue", minValue())
.add("MaxValue", maxValue()).add("IsTunable", isTunable()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "minValue":
return Optional.ofNullable(clazz.cast(minValue()));
case "maxValue":
return Optional.ofNullable(clazz.cast(maxValue()));
case "isTunable":
return Optional.ofNullable(clazz.cast(isTunable()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy