Evaluators¶
Defines
-
REGISTER_EVALUATOR
(__type_name, __class_name)¶
-
namespace
paddle
¶ -
class
AucEvaluator
¶ Inherits from paddle::Evaluator
Public Functions
-
AucEvaluator
(int32_t colIdx)¶ evaluate AUC using colIdx-th column as prediction.
colIdx = 0: the 0-th column. colIdx > 0: the colIdx-th column. colIdx < 0: the last colIdx-th column.
-
virtual void
start
()¶ start to evaluate some data
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
virtual void
printStats
(std::ostream &os)¶
-
virtual void
distributeEval
(ParameterClient2 *client)¶
Private Members
-
double
statPos_
[kBinNum_+1]¶
-
double
statNeg_
[kBinNum_+1]¶
-
int32_t
colIdx_
¶
-
uint32_t
realColumnIdx_
¶
-
IVectorPtr
cpuLabel_
¶
Private Static Functions
-
static double
trapezoidArea
(double X1, double X2, double Y1, double Y2)¶
-
-
class
DummyEvaluator
¶ Inherits from paddle::Evaluator
Public Functions
-
DummyEvaluator
()¶
-
virtual void
init
(const EvaluatorConfig&)¶
-
virtual void
start
()¶ start to evaluate some data
-
virtual void
eval
(const NeuralNetwork &nn)¶ Process a batch of data.
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
virtual void
finish
()¶ finish the evaluation.
-
virtual void
printStats
(std::ostream&)¶
-
-
class
Evaluator
¶ Subclassed by paddle::AucEvaluator, paddle::ChunkEvaluator, paddle::ClassificationErrorEvaluator, paddle::ColumnSumEvaluator, paddle::CombinedEvaluator, paddle::CTCErrorEvaluator, paddle::DummyEvaluator, paddle::GradientPrinter, paddle::MaxFramePrinter, paddle::MaxIdPrinter, paddle::MultiCombinedEvaluator, paddle::PnpairEvaluator, paddle::PrecisionRecallEvaluator, paddle::RankAucEvaluator, paddle::SequenceTextPrinter, paddle::SumEvaluator, paddle::ValuePrinter
Public Functions
-
Evaluator
()¶
-
virtual
~Evaluator
()¶
-
virtual void
init
(const EvaluatorConfig &config)¶
-
virtual void
start
()¶ start to evaluate some data
-
virtual void
eval
(const NeuralNetwork &nn)¶ Process a batch of data.
-
virtual real
evalImp
(std::vector<Argument> &arguments) = 0¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
virtual void
updateSamplesNum
(const std::vector<Argument> &arguments)¶ Update the number of processed samples
-
virtual void
distributeEval
(ParameterClient2 *client)¶
-
void
mergeResultsOfAllClients
(ParameterClient2 *client)¶
-
virtual void
finish
()¶ finish the evaluation.
-
virtual void
printStats
(std::ostream &os)¶
-
-
class
PnpairEvaluator
¶ - #include <Evaluator.h>
Positive-negative pair rate Evaluator
Inherits from paddle::Evaluator
Public Functions
-
PnpairEvaluator
()¶
-
virtual void
start
()¶ start to evaluate some data
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
void
printPredictResults
()¶
-
void
stat
(size_t start, size_t end, PredictionResult *answers, double &pos, double &neg, double &spe)¶
-
void
calc
(std::vector<PredictionResult> &predictArray)¶
-
virtual void
finish
()¶ finish the evaluation.
-
virtual void
printStats
(std::ostream &os)¶
-
virtual void
distributeEval
(ParameterClient2 *client)¶
Public Members
-
std::vector<PredictionResult>
predictArray_
¶
Private Static Attributes
-
const uint32_t
kPairArrayNum_
¶
-
-
class
PrecisionRecallEvaluator
¶ Inherits from paddle::Evaluator
Public Functions
-
PrecisionRecallEvaluator
()¶
-
virtual void
start
()¶ start to evaluate some data
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
virtual void
printStats
(std::ostream &os)¶
-
virtual void
distributeEval
(ParameterClient2 *client)¶
Private Functions
-
void
calcStatsInfo
(const MatrixPtr &output, const IVectorPtr &label, const MatrixPtr &weight)¶
-
-
class
RankAucEvaluator
¶ - #include <Evaluator.h>
RankAucEvaluator calculates the AUC of each list (i.e., titles under the same query), and averages them.
Each list should be organized as a sequence. The inputs of this evaluator is [output, click, pv]. If pv is not provided, it will be set to 1. The types of click and pv are dense value.
Inherits from paddle::Evaluator
Public Functions
-
virtual void
start
()¶ start to evaluate some data
-
virtual void
updateSamplesNum
(const std::vector<Argument> &arguments)¶ Update the number of processed samples
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
virtual void
distributeEval
(ParameterClient2 *client)¶
Private Functions
-
double
calcRankAuc
(real *outputData, real *clickData, real *pvData, size_t size)¶
-
virtual void
-
class
-
namespace
paddle
¶ Functions
-
REGISTER_EVALUATOR
(chunk, ChunkEvaluator)¶
-
class
ChunkEvaluator
¶ Chunk evaluator is used to evaluate segment labelling accuracy for a sequence. It calculates the chunk detection F1 score.
A chunk is correctly detected if its beginning, end and type are correct. Other chunk type is ignored. For each label in the label sequence, we have
tagType = label % numTagType chunkType = label / numTagType otherChunkType = numChunkTypes
The total number of different labels is numTagType*numChunkTypes+1 We support 4 labelling scheme The tag type for each of the scheme is shown as follows:
Scheme Begin Inside End Single plain 0 - - - IOB 0 1 - - IOE - 0 1 - IOBES 0 1 2 3
‘plain’ means the whole chunk must contain exactly the same chunk label.
Inherits from paddle::Evaluator
Public Functions
-
virtual void
init
(const EvaluatorConfig &config)¶
-
virtual void
start
()¶ start to evaluate some data
-
virtual void
printStats
(std::ostream &os)¶
-
virtual void
distributeEval
(ParameterClient2 *client)¶
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
void
eval1
(int *output, int *label, int length)¶
-
bool
isChunkEnd
(int prevTag, int prevType, int tag, int type)¶
-
bool
isChunkBegin
(int prevTag, int prevType, int tag, int type)¶
Private Members
-
int
otherChunkType_
¶
-
int
numChunkTypes_
¶
-
int
numTagTypes_
¶
-
int
tagBegin_
¶
-
int
tagInside_
¶
-
int
tagEnd_
¶
-
int
tagSingle_
¶
-
int64_t
numLabelSegments_
¶
-
int64_t
numOutputSegments_
¶
-
int64_t
numCorrect_
¶
-
struct
Segment
¶
-
virtual void
-
-
namespace
paddle
¶ Functions
-
REGISTER_EVALUATOR
(ctc_edit_distance, CTCErrorEvaluator)¶
-
class
CTCErrorEvaluator
¶ calculate sequence-to-sequence edit distance
Inherits from paddle::Evaluator
Public Functions
-
CTCErrorEvaluator
()¶
-
virtual real
evalImp
(std::vector<Argument> &arguments)¶ Process a batch of data. return the score for the batch if it make sense to sum the score across batches. Otherwise evaluator should return 0 and override finish() and printStats() to do the right calculation.
-
virtual void
eval
(const NeuralNetwork &nn)¶ Process a batch of data.
-
virtual void
start
()¶ start to evaluate some data
-
virtual void
printStats
(std::ostream &os)¶
-
virtual void
distributeEval
(ParameterClient2 *client)¶
Private Functions
-
std::vector<int>
path2String
(const std::vector<int> &path)¶
-
std::vector<int>
bestLabelSeq
()¶
-
real
stringAlignment
(std::vector<int> >Str, std::vector<int> &recogStr, bool backtrace = true, real sp = 1.0, real dp = 1.0, real ip = 1.0)¶
-
real
editDistance
(real *output, int numTimes, int numClasses, int *labels, int labelsLen)¶
-
-