Skip to content
Snippets Groups Projects
Commit 2e407928 authored by Franck Dary's avatar Franck Dary
Browse files

Added more info to errors evaluation

parent 6a9e3b32
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,16 @@ class Error ...@@ -18,12 +18,16 @@ class Error
std::string gold; std::string gold;
Classifier::WeightedActions weightedActions; Classifier::WeightedActions weightedActions;
std::string type; std::string type;
int indexOfPrediction;
int indexOfGold;
int distanceWithGold;
public : public :
Error(std::string &, std::string &, Classifier::WeightedActions &); Error(std::string &, std::string &, Classifier::WeightedActions &);
bool isError() const; bool isError() const;
const std::string & getType() const; const std::string & getType() const;
const bool goldWasAtDistance();
}; };
class ErrorSequence class ErrorSequence
......
...@@ -4,6 +4,31 @@ Error::Error(std::string & prediction, std::string & gold, Classifier::WeightedA ...@@ -4,6 +4,31 @@ Error::Error(std::string & prediction, std::string & gold, Classifier::WeightedA
prediction(prediction), gold(gold), weightedActions(weightedActions) prediction(prediction), gold(gold), weightedActions(weightedActions)
{ {
type = prediction + "->" + gold; type = prediction + "->" + gold;
indexOfPrediction = -1;
indexOfGold = -1;
distanceWithGold = 0;
for (unsigned int i = 0; i < weightedActions.size(); i++)
{
if (weightedActions[i].second.second == prediction)
indexOfPrediction = i;
if (weightedActions[i].second.second == gold)
indexOfGold = i;
if (weightedActions[i].first && indexOfPrediction != -1 && indexOfGold == -1)
distanceWithGold++;
}
if (indexOfPrediction == -1 || indexOfGold == -1)
{
fprintf(stderr, "ERROR (%s) : weightedActions do not contain prediction or gold. Aborting.\n", ERRINFO);
exit(1);
}
if (distanceWithGold != 0 && !isError())
{
fprintf(stderr, "ERROR (%s) : incoherent Error initialization. Aborting.\n", ERRINFO);
exit(1);
}
} }
const std::string & Error::getType() const const std::string & Error::getType() const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment