com.amazonaws.services.sagemaker.model.ClarifyShapConfig Maven / Gradle / Ivy
Show all versions of aws-java-sdk-sagemaker Show documentation
/*
* Copyright 2019-2024 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;
/**
*
* The configuration for SHAP analysis using SageMaker Clarify Explainer.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ClarifyShapConfig implements Serializable, Cloneable, StructuredPojo {
/**
*
* The configuration for the SHAP baseline of the Kernal SHAP algorithm.
*
*/
private ClarifyShapBaselineConfig shapBaselineConfig;
/**
*
* The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
*
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
*
*/
private Integer numberOfSamples;
/**
*
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for model
* predictions. Defaults to false.
*
*/
private Boolean useLogit;
/**
*
* The starting value used to initialize the random number generator in the explainer. Provide a value for this
* parameter to obtain a deterministic SHAP result.
*
*/
private Integer seed;
/**
*
* A parameter that indicates if text features are treated as text and explanations are provided for individual
* units of text. Required for natural language processing (NLP) explainability only.
*
*/
private ClarifyTextConfig textConfig;
/**
*
* The configuration for the SHAP baseline of the Kernal SHAP algorithm.
*
*
* @param shapBaselineConfig
* The configuration for the SHAP baseline of the Kernal SHAP algorithm.
*/
public void setShapBaselineConfig(ClarifyShapBaselineConfig shapBaselineConfig) {
this.shapBaselineConfig = shapBaselineConfig;
}
/**
*
* The configuration for the SHAP baseline of the Kernal SHAP algorithm.
*
*
* @return The configuration for the SHAP baseline of the Kernal SHAP algorithm.
*/
public ClarifyShapBaselineConfig getShapBaselineConfig() {
return this.shapBaselineConfig;
}
/**
*
* The configuration for the SHAP baseline of the Kernal SHAP algorithm.
*
*
* @param shapBaselineConfig
* The configuration for the SHAP baseline of the Kernal SHAP algorithm.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ClarifyShapConfig withShapBaselineConfig(ClarifyShapBaselineConfig shapBaselineConfig) {
setShapBaselineConfig(shapBaselineConfig);
return this;
}
/**
*
* The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
*
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
*
*
* @param numberOfSamples
* The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
*/
public void setNumberOfSamples(Integer numberOfSamples) {
this.numberOfSamples = numberOfSamples;
}
/**
*
* The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
*
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
*
*
* @return The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
*/
public Integer getNumberOfSamples() {
return this.numberOfSamples;
}
/**
*
* The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
*
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
*
*
* @param numberOfSamples
* The number of samples to be used for analysis by the Kernal SHAP algorithm.
*
* The number of samples determines the size of the synthetic dataset, which has an impact on latency of
* explainability requests. For more information, see the Synthetic data of Configure and create an endpoint.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ClarifyShapConfig withNumberOfSamples(Integer numberOfSamples) {
setNumberOfSamples(numberOfSamples);
return this;
}
/**
*
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for model
* predictions. Defaults to false.
*
*
* @param useLogit
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for
* model predictions. Defaults to false.
*/
public void setUseLogit(Boolean useLogit) {
this.useLogit = useLogit;
}
/**
*
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for model
* predictions. Defaults to false.
*
*
* @return A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for
* model predictions. Defaults to false.
*/
public Boolean getUseLogit() {
return this.useLogit;
}
/**
*
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for model
* predictions. Defaults to false.
*
*
* @param useLogit
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for
* model predictions. Defaults to false.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ClarifyShapConfig withUseLogit(Boolean useLogit) {
setUseLogit(useLogit);
return this;
}
/**
*
* A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for model
* predictions. Defaults to false.
*
*
* @return A Boolean toggle to indicate if you want to use the logit function (true) or log-odds units (false) for
* model predictions. Defaults to false.
*/
public Boolean isUseLogit() {
return this.useLogit;
}
/**
*
* The starting value used to initialize the random number generator in the explainer. Provide a value for this
* parameter to obtain a deterministic SHAP result.
*
*
* @param seed
* The starting value used to initialize the random number generator in the explainer. Provide a value for
* this parameter to obtain a deterministic SHAP result.
*/
public void setSeed(Integer seed) {
this.seed = seed;
}
/**
*
* The starting value used to initialize the random number generator in the explainer. Provide a value for this
* parameter to obtain a deterministic SHAP result.
*
*
* @return The starting value used to initialize the random number generator in the explainer. Provide a value for
* this parameter to obtain a deterministic SHAP result.
*/
public Integer getSeed() {
return this.seed;
}
/**
*
* The starting value used to initialize the random number generator in the explainer. Provide a value for this
* parameter to obtain a deterministic SHAP result.
*
*
* @param seed
* The starting value used to initialize the random number generator in the explainer. Provide a value for
* this parameter to obtain a deterministic SHAP result.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ClarifyShapConfig withSeed(Integer seed) {
setSeed(seed);
return this;
}
/**
*
* A parameter that indicates if text features are treated as text and explanations are provided for individual
* units of text. Required for natural language processing (NLP) explainability only.
*
*
* @param textConfig
* A parameter that indicates if text features are treated as text and explanations are provided for
* individual units of text. Required for natural language processing (NLP) explainability only.
*/
public void setTextConfig(ClarifyTextConfig textConfig) {
this.textConfig = textConfig;
}
/**
*
* A parameter that indicates if text features are treated as text and explanations are provided for individual
* units of text. Required for natural language processing (NLP) explainability only.
*
*
* @return A parameter that indicates if text features are treated as text and explanations are provided for
* individual units of text. Required for natural language processing (NLP) explainability only.
*/
public ClarifyTextConfig getTextConfig() {
return this.textConfig;
}
/**
*
* A parameter that indicates if text features are treated as text and explanations are provided for individual
* units of text. Required for natural language processing (NLP) explainability only.
*
*
* @param textConfig
* A parameter that indicates if text features are treated as text and explanations are provided for
* individual units of text. Required for natural language processing (NLP) explainability only.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ClarifyShapConfig withTextConfig(ClarifyTextConfig textConfig) {
setTextConfig(textConfig);
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 (getShapBaselineConfig() != null)
sb.append("ShapBaselineConfig: ").append(getShapBaselineConfig()).append(",");
if (getNumberOfSamples() != null)
sb.append("NumberOfSamples: ").append(getNumberOfSamples()).append(",");
if (getUseLogit() != null)
sb.append("UseLogit: ").append(getUseLogit()).append(",");
if (getSeed() != null)
sb.append("Seed: ").append(getSeed()).append(",");
if (getTextConfig() != null)
sb.append("TextConfig: ").append(getTextConfig());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ClarifyShapConfig == false)
return false;
ClarifyShapConfig other = (ClarifyShapConfig) obj;
if (other.getShapBaselineConfig() == null ^ this.getShapBaselineConfig() == null)
return false;
if (other.getShapBaselineConfig() != null && other.getShapBaselineConfig().equals(this.getShapBaselineConfig()) == false)
return false;
if (other.getNumberOfSamples() == null ^ this.getNumberOfSamples() == null)
return false;
if (other.getNumberOfSamples() != null && other.getNumberOfSamples().equals(this.getNumberOfSamples()) == false)
return false;
if (other.getUseLogit() == null ^ this.getUseLogit() == null)
return false;
if (other.getUseLogit() != null && other.getUseLogit().equals(this.getUseLogit()) == false)
return false;
if (other.getSeed() == null ^ this.getSeed() == null)
return false;
if (other.getSeed() != null && other.getSeed().equals(this.getSeed()) == false)
return false;
if (other.getTextConfig() == null ^ this.getTextConfig() == null)
return false;
if (other.getTextConfig() != null && other.getTextConfig().equals(this.getTextConfig()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getShapBaselineConfig() == null) ? 0 : getShapBaselineConfig().hashCode());
hashCode = prime * hashCode + ((getNumberOfSamples() == null) ? 0 : getNumberOfSamples().hashCode());
hashCode = prime * hashCode + ((getUseLogit() == null) ? 0 : getUseLogit().hashCode());
hashCode = prime * hashCode + ((getSeed() == null) ? 0 : getSeed().hashCode());
hashCode = prime * hashCode + ((getTextConfig() == null) ? 0 : getTextConfig().hashCode());
return hashCode;
}
@Override
public ClarifyShapConfig clone() {
try {
return (ClarifyShapConfig) 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.ClarifyShapConfigMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}