/* * Copyright 2010-2023 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.comprehend.model; import java.io.Serializable; /** *

* Detailed information about the accuracy of an entity recognizer. *

*/ public class EntityRecognizerEvaluationMetrics implements Serializable { /** *

* A measure of the usefulness of the recognizer results in the test data. * High precision means that the recognizer returned substantially more * relevant results than irrelevant ones. *

*/ private Double precision; /** *

* A measure of how complete the recognizer results are for the test data. * High recall means that the recognizer returned most of the relevant * results. *

*/ private Double recall; /** *

* A measure of how accurate the recognizer results are for the test data. * It is derived from the Precision and Recall * values. The F1Score is the harmonic average of the two * scores. For plain text entity recognizer models, the range is 0 to 100, * where 100 is the best score. For PDF/Word entity recognizer models, the * range is 0 to 1, where 1 is the best score. *

*/ private Double f1Score; /** *

* A measure of the usefulness of the recognizer results in the test data. * High precision means that the recognizer returned substantially more * relevant results than irrelevant ones. *

* * @return

* A measure of the usefulness of the recognizer results in the test * data. High precision means that the recognizer returned * substantially more relevant results than irrelevant ones. *

*/ public Double getPrecision() { return precision; } /** *

* A measure of the usefulness of the recognizer results in the test data. * High precision means that the recognizer returned substantially more * relevant results than irrelevant ones. *

* * @param precision

* A measure of the usefulness of the recognizer results in the * test data. High precision means that the recognizer returned * substantially more relevant results than irrelevant ones. *

*/ public void setPrecision(Double precision) { this.precision = precision; } /** *

* A measure of the usefulness of the recognizer results in the test data. * High precision means that the recognizer returned substantially more * relevant results than irrelevant ones. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param precision

* A measure of the usefulness of the recognizer results in the * test data. High precision means that the recognizer returned * substantially more relevant results than irrelevant ones. *

* @return A reference to this updated object so that method calls can be * chained together. */ public EntityRecognizerEvaluationMetrics withPrecision(Double precision) { this.precision = precision; return this; } /** *

* A measure of how complete the recognizer results are for the test data. * High recall means that the recognizer returned most of the relevant * results. *

* * @return

* A measure of how complete the recognizer results are for the test * data. High recall means that the recognizer returned most of the * relevant results. *

*/ public Double getRecall() { return recall; } /** *

* A measure of how complete the recognizer results are for the test data. * High recall means that the recognizer returned most of the relevant * results. *

* * @param recall

* A measure of how complete the recognizer results are for the * test data. High recall means that the recognizer returned most * of the relevant results. *

*/ public void setRecall(Double recall) { this.recall = recall; } /** *

* A measure of how complete the recognizer results are for the test data. * High recall means that the recognizer returned most of the relevant * results. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param recall

* A measure of how complete the recognizer results are for the * test data. High recall means that the recognizer returned most * of the relevant results. *

* @return A reference to this updated object so that method calls can be * chained together. */ public EntityRecognizerEvaluationMetrics withRecall(Double recall) { this.recall = recall; return this; } /** *

* A measure of how accurate the recognizer results are for the test data. * It is derived from the Precision and Recall * values. The F1Score is the harmonic average of the two * scores. For plain text entity recognizer models, the range is 0 to 100, * where 100 is the best score. For PDF/Word entity recognizer models, the * range is 0 to 1, where 1 is the best score. *

* * @return

* A measure of how accurate the recognizer results are for the test * data. It is derived from the Precision and * Recall values. The F1Score is the * harmonic average of the two scores. For plain text entity * recognizer models, the range is 0 to 100, where 100 is the best * score. For PDF/Word entity recognizer models, the range is 0 to * 1, where 1 is the best score. *

*/ public Double getF1Score() { return f1Score; } /** *

* A measure of how accurate the recognizer results are for the test data. * It is derived from the Precision and Recall * values. The F1Score is the harmonic average of the two * scores. For plain text entity recognizer models, the range is 0 to 100, * where 100 is the best score. For PDF/Word entity recognizer models, the * range is 0 to 1, where 1 is the best score. *

* * @param f1Score

* A measure of how accurate the recognizer results are for the * test data. It is derived from the Precision and * Recall values. The F1Score is the * harmonic average of the two scores. For plain text entity * recognizer models, the range is 0 to 100, where 100 is the * best score. For PDF/Word entity recognizer models, the range * is 0 to 1, where 1 is the best score. *

*/ public void setF1Score(Double f1Score) { this.f1Score = f1Score; } /** *

* A measure of how accurate the recognizer results are for the test data. * It is derived from the Precision and Recall * values. The F1Score is the harmonic average of the two * scores. For plain text entity recognizer models, the range is 0 to 100, * where 100 is the best score. For PDF/Word entity recognizer models, the * range is 0 to 1, where 1 is the best score. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param f1Score

* A measure of how accurate the recognizer results are for the * test data. It is derived from the Precision and * Recall values. The F1Score is the * harmonic average of the two scores. For plain text entity * recognizer models, the range is 0 to 100, where 100 is the * best score. For PDF/Word entity recognizer models, the range * is 0 to 1, where 1 is the best score. *

* @return A reference to this updated object so that method calls can be * chained together. */ public EntityRecognizerEvaluationMetrics withF1Score(Double f1Score) { this.f1Score = f1Score; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPrecision() != null) sb.append("Precision: " + getPrecision() + ","); if (getRecall() != null) sb.append("Recall: " + getRecall() + ","); if (getF1Score() != null) sb.append("F1Score: " + getF1Score()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPrecision() == null) ? 0 : getPrecision().hashCode()); hashCode = prime * hashCode + ((getRecall() == null) ? 0 : getRecall().hashCode()); hashCode = prime * hashCode + ((getF1Score() == null) ? 0 : getF1Score().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof EntityRecognizerEvaluationMetrics == false) return false; EntityRecognizerEvaluationMetrics other = (EntityRecognizerEvaluationMetrics) obj; if (other.getPrecision() == null ^ this.getPrecision() == null) return false; if (other.getPrecision() != null && other.getPrecision().equals(this.getPrecision()) == false) return false; if (other.getRecall() == null ^ this.getRecall() == null) return false; if (other.getRecall() != null && other.getRecall().equals(this.getRecall()) == false) return false; if (other.getF1Score() == null ^ this.getF1Score() == null) return false; if (other.getF1Score() != null && other.getF1Score().equals(this.getF1Score()) == false) return false; return true; } }