public class ClassificationEvaluation extends AnnotatorEvaluation implements org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>
AnnotatorEvaluation.Measure| Modifier and Type | Field and Description |
|---|---|
protected LookupCacheEncoder |
encoder |
protected org.nd4j.evaluation.classification.Evaluation |
eval |
protected int |
K |
protected double |
mapsum
average precision
|
protected double |
mrrsum
average precision
|
protected int |
numClasses |
protected double |
p1sum
average precision
|
protected double |
pksum
average precision
|
protected double |
r1sum
average precision
|
protected double |
rksum
average precision
|
countAnnotations, countDocs, countExamples, countSentences, countTokens, expectedSource, experimentName, log, predictedSource| Constructor and Description |
|---|
ClassificationEvaluation(String experimentName,
Annotation.Source expected,
Annotation.Source predicted,
LookupCacheEncoder encoder,
int K) |
ClassificationEvaluation(String experimentName,
LookupCacheEncoder encoder) |
| Modifier and Type | Method and Description |
|---|---|
void |
calculateScores(Collection<Document> docs)
Not used.
|
void |
calculateScoresFromAnnotations(Collection<Document> documents,
Class<? extends Annotation> annotationClass,
boolean matchAllPredicted)
Calculates Evaluation from Annotations in the Documents
|
<T extends Tag> |
calculateScoresFromTags(Collection<Document> documents,
Class<? extends Span> spanClass,
Class<T> tagClass)
Calculates Evaluation from Tags in the Spans
|
protected void |
clear() |
protected double |
div(double n,
double d)
safe division, where n/0 = 0
|
void |
eval(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray networkPredictions) |
void |
eval(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray networkPredictions,
org.nd4j.linalg.api.ndarray.INDArray maskArray) |
void |
eval(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray networkPredictions,
List<? extends Serializable> recordMetaData) |
void |
evalExample(org.nd4j.linalg.api.ndarray.INDArray Y,
org.nd4j.linalg.api.ndarray.INDArray Z)
Update scores from a single Example prediction
|
void |
evalTimeSeries(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray predicted) |
void |
evalTimeSeries(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray predictions,
org.nd4j.linalg.api.ndarray.INDArray labelsMask) |
double |
getAccuracy()
Micro/Macro Accuracy
|
protected double |
getAccuracy(int c)
Accuracy per class
|
double |
getAccuracyK() |
protected double |
getF1(int c)
F1 score per class
|
double |
getMacroF1()
Macro F1 score (average F1 over all classes).
|
double |
getMacroPrecision()
Macro Precision (average Precision over all classes).
|
double |
getMacroRecall()
Macro Recall (average recall over all classes).
|
double |
getMAP() |
double |
getMicroF1()
Micro F1 score (average F1 over all examples).
|
double |
getMicroPrecision()
Micro Precision (average precision over all examples).
|
double |
getMicroRecall()
Micro Recall (average recall over all examples).
|
protected double |
getMRR() |
protected double |
getPrecision(int c)
Precision per class
|
double |
getPrecision1() |
double |
getPrecisionK() |
protected double |
getRecall(int c)
Recall per class
|
double |
getRecall1() |
double |
getRecallK() |
double |
getScore() |
protected static int |
maxIndex(org.nd4j.linalg.api.ndarray.INDArray Y) |
void |
merge(ClassificationEvaluation other) |
String |
printClassificationAtKStats()
Print micro-averaged scores for evaluation @K
|
String |
printClassificationStats() |
protected static int |
rank(int idx,
org.nd4j.linalg.api.ndarray.INDArray l)
get position of index idx in ranked labels l
|
void |
reset() |
String |
stats() |
String |
toJson() |
String |
toYaml() |
calculateScores, countAnnotations, countDocuments, countExamples, countSentences, countTokens, fDbl, fInt, fStr, printEvaluationStatsprotected LookupCacheEncoder encoder
protected int numClasses
protected int K
protected org.nd4j.evaluation.classification.Evaluation eval
protected double mrrsum
protected double mapsum
protected double p1sum
protected double r1sum
protected double pksum
protected double rksum
public ClassificationEvaluation(String experimentName, LookupCacheEncoder encoder)
public ClassificationEvaluation(String experimentName, Annotation.Source expected, Annotation.Source predicted, LookupCacheEncoder encoder, int K)
protected void clear()
public double getScore()
getScore in class AnnotatorEvaluationpublic void calculateScores(Collection<Document> docs)
calculateScores in class AnnotatorEvaluationpublic void calculateScoresFromAnnotations(Collection<Document> documents, Class<? extends Annotation> annotationClass, boolean matchAllPredicted)
matchAllPredicted - - if TRUE, all remaining unmatched predicted annotations will be matched to expected via position, otherwise they are ignoredpublic <T extends Tag> void calculateScoresFromTags(Collection<Document> documents, Class<? extends Span> spanClass, Class<T> tagClass)
public void evalExample(org.nd4j.linalg.api.ndarray.INDArray Y,
org.nd4j.linalg.api.ndarray.INDArray Z)
Y - - correct labels e {0,1}^dZ - - predicted labels e R^d@param Yprotected double div(double n,
double d)
div in class AnnotatorEvaluationprotected static int rank(int idx,
org.nd4j.linalg.api.ndarray.INDArray l)
protected static int maxIndex(org.nd4j.linalg.api.ndarray.INDArray Y)
public double getAccuracy()
public double getAccuracyK()
protected double getAccuracy(int c)
c - - class indexpublic double getMicroPrecision()
public double getMacroPrecision()
protected double getPrecision(int c)
c - - class indexpublic double getMicroRecall()
public double getMacroRecall()
protected double getRecall(int c)
c - - class indexpublic double getMicroF1()
public double getMacroF1()
protected double getF1(int c)
c - - class indexprotected double getMRR()
public double getMAP()
public double getPrecisionK()
public double getRecallK()
public double getPrecision1()
public double getRecall1()
public void eval(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray networkPredictions)
eval in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public void eval(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray networkPredictions,
List<? extends Serializable> recordMetaData)
eval in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public void eval(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray networkPredictions,
org.nd4j.linalg.api.ndarray.INDArray maskArray)
eval in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public void evalTimeSeries(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray predicted)
evalTimeSeries in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public void evalTimeSeries(org.nd4j.linalg.api.ndarray.INDArray labels,
org.nd4j.linalg.api.ndarray.INDArray predictions,
org.nd4j.linalg.api.ndarray.INDArray labelsMask)
evalTimeSeries in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public void merge(ClassificationEvaluation other)
merge in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public void reset()
reset in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public String stats()
stats in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public String toJson()
toJson in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public String toYaml()
toYaml in interface org.nd4j.evaluation.IEvaluation<ClassificationEvaluation>public String printClassificationAtKStats()
public String printClassificationStats()
Copyright © 2019. All rights reserved.