com.amazonaws.services.forecast.model.Metrics Maven / Gradle / Ivy
/*
* 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.forecast.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Provides metrics that are used to evaluate the performance of a predictor. This object is part of the
* WindowSummary object.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Metrics implements Serializable, Cloneable, StructuredPojo {
/**
*
* The root-mean-square error (RMSE).
*
*/
@Deprecated
private Double rMSE;
/**
*
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*
*/
private java.util.List weightedQuantileLosses;
/**
*
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE), mean
* absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage error
* (WAPE).
*
*/
private java.util.List errorMetrics;
/**
*
* The average value of all weighted quantile losses.
*
*/
private Double averageWeightedQuantileLoss;
/**
*
* The root-mean-square error (RMSE).
*
*
* @param rMSE
* The root-mean-square error (RMSE).
*/
@Deprecated
public void setRMSE(Double rMSE) {
this.rMSE = rMSE;
}
/**
*
* The root-mean-square error (RMSE).
*
*
* @return The root-mean-square error (RMSE).
*/
@Deprecated
public Double getRMSE() {
return this.rMSE;
}
/**
*
* The root-mean-square error (RMSE).
*
*
* @param rMSE
* The root-mean-square error (RMSE).
* @return Returns a reference to this object so that method calls can be chained together.
*/
@Deprecated
public Metrics withRMSE(Double rMSE) {
setRMSE(rMSE);
return this;
}
/**
*
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*
*
* @return An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*/
public java.util.List getWeightedQuantileLosses() {
return weightedQuantileLosses;
}
/**
*
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*
*
* @param weightedQuantileLosses
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*/
public void setWeightedQuantileLosses(java.util.Collection weightedQuantileLosses) {
if (weightedQuantileLosses == null) {
this.weightedQuantileLosses = null;
return;
}
this.weightedQuantileLosses = new java.util.ArrayList(weightedQuantileLosses);
}
/**
*
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setWeightedQuantileLosses(java.util.Collection)} or
* {@link #withWeightedQuantileLosses(java.util.Collection)} if you want to override the existing values.
*
*
* @param weightedQuantileLosses
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metrics withWeightedQuantileLosses(WeightedQuantileLoss... weightedQuantileLosses) {
if (this.weightedQuantileLosses == null) {
setWeightedQuantileLosses(new java.util.ArrayList(weightedQuantileLosses.length));
}
for (WeightedQuantileLoss ele : weightedQuantileLosses) {
this.weightedQuantileLosses.add(ele);
}
return this;
}
/**
*
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
*
*
* @param weightedQuantileLosses
* An array of weighted quantile losses. Quantiles divide a probability distribution into regions of equal
* probability. The distribution in this case is the loss function.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metrics withWeightedQuantileLosses(java.util.Collection weightedQuantileLosses) {
setWeightedQuantileLosses(weightedQuantileLosses);
return this;
}
/**
*
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE), mean
* absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage error
* (WAPE).
*
*
* @return Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE),
* mean absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage
* error (WAPE).
*/
public java.util.List getErrorMetrics() {
return errorMetrics;
}
/**
*
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE), mean
* absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage error
* (WAPE).
*
*
* @param errorMetrics
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE),
* mean absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage
* error (WAPE).
*/
public void setErrorMetrics(java.util.Collection errorMetrics) {
if (errorMetrics == null) {
this.errorMetrics = null;
return;
}
this.errorMetrics = new java.util.ArrayList(errorMetrics);
}
/**
*
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE), mean
* absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage error
* (WAPE).
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setErrorMetrics(java.util.Collection)} or {@link #withErrorMetrics(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param errorMetrics
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE),
* mean absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage
* error (WAPE).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metrics withErrorMetrics(ErrorMetric... errorMetrics) {
if (this.errorMetrics == null) {
setErrorMetrics(new java.util.ArrayList(errorMetrics.length));
}
for (ErrorMetric ele : errorMetrics) {
this.errorMetrics.add(ele);
}
return this;
}
/**
*
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE), mean
* absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage error
* (WAPE).
*
*
* @param errorMetrics
* Provides detailed error metrics for each forecast type. Metrics include root-mean square-error (RMSE),
* mean absolute percentage error (MAPE), mean absolute scaled error (MASE), and weighted average percentage
* error (WAPE).
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metrics withErrorMetrics(java.util.Collection errorMetrics) {
setErrorMetrics(errorMetrics);
return this;
}
/**
*
* The average value of all weighted quantile losses.
*
*
* @param averageWeightedQuantileLoss
* The average value of all weighted quantile losses.
*/
public void setAverageWeightedQuantileLoss(Double averageWeightedQuantileLoss) {
this.averageWeightedQuantileLoss = averageWeightedQuantileLoss;
}
/**
*
* The average value of all weighted quantile losses.
*
*
* @return The average value of all weighted quantile losses.
*/
public Double getAverageWeightedQuantileLoss() {
return this.averageWeightedQuantileLoss;
}
/**
*
* The average value of all weighted quantile losses.
*
*
* @param averageWeightedQuantileLoss
* The average value of all weighted quantile losses.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Metrics withAverageWeightedQuantileLoss(Double averageWeightedQuantileLoss) {
setAverageWeightedQuantileLoss(averageWeightedQuantileLoss);
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 (getRMSE() != null)
sb.append("RMSE: ").append(getRMSE()).append(",");
if (getWeightedQuantileLosses() != null)
sb.append("WeightedQuantileLosses: ").append(getWeightedQuantileLosses()).append(",");
if (getErrorMetrics() != null)
sb.append("ErrorMetrics: ").append(getErrorMetrics()).append(",");
if (getAverageWeightedQuantileLoss() != null)
sb.append("AverageWeightedQuantileLoss: ").append(getAverageWeightedQuantileLoss());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Metrics == false)
return false;
Metrics other = (Metrics) obj;
if (other.getRMSE() == null ^ this.getRMSE() == null)
return false;
if (other.getRMSE() != null && other.getRMSE().equals(this.getRMSE()) == false)
return false;
if (other.getWeightedQuantileLosses() == null ^ this.getWeightedQuantileLosses() == null)
return false;
if (other.getWeightedQuantileLosses() != null && other.getWeightedQuantileLosses().equals(this.getWeightedQuantileLosses()) == false)
return false;
if (other.getErrorMetrics() == null ^ this.getErrorMetrics() == null)
return false;
if (other.getErrorMetrics() != null && other.getErrorMetrics().equals(this.getErrorMetrics()) == false)
return false;
if (other.getAverageWeightedQuantileLoss() == null ^ this.getAverageWeightedQuantileLoss() == null)
return false;
if (other.getAverageWeightedQuantileLoss() != null && other.getAverageWeightedQuantileLoss().equals(this.getAverageWeightedQuantileLoss()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getRMSE() == null) ? 0 : getRMSE().hashCode());
hashCode = prime * hashCode + ((getWeightedQuantileLosses() == null) ? 0 : getWeightedQuantileLosses().hashCode());
hashCode = prime * hashCode + ((getErrorMetrics() == null) ? 0 : getErrorMetrics().hashCode());
hashCode = prime * hashCode + ((getAverageWeightedQuantileLoss() == null) ? 0 : getAverageWeightedQuantileLoss().hashCode());
return hashCode;
}
@Override
public Metrics clone() {
try {
return (Metrics) 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.forecast.model.transform.MetricsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}