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

Added -x (extra columns) option when invoking eval script

parent 01f7d410
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ class Decoder
Decoder(ReadingMachine & machine);
void decode(BaseConfig & config, std::size_t beamSize, float beamThreshold, bool debug, bool printAdvancement);
void evaluate(const Config & config, std::filesystem::path modelPath, const std::string goldTSV);
void evaluate(const Config & config, std::filesystem::path modelPath, const std::string goldTSV, const std::set<std::string> & predicted);
std::vector<std::pair<float,std::string>> getF1Scores(const std::set<std::string> & colNames) const;
std::vector<std::pair<float,std::string>> getAlignedAccs(const std::set<std::string> & colNames) const;
std::vector<std::pair<float,std::string>> getRecalls(const std::set<std::string> & colNames) const;
......
......@@ -135,7 +135,7 @@ std::string Decoder::getMetricOfColName(const std::string & colName) const
return colName;
}
void Decoder::evaluate(const Config & config, std::filesystem::path modelPath, const std::string goldTSV)
void Decoder::evaluate(const Config & config, std::filesystem::path modelPath, const std::string goldTSV, const std::set<std::string> & predicted)
{
evaluation.clear();
auto predictedTSV = (modelPath/"predicted_dev.tsv").string();
......@@ -143,7 +143,7 @@ void Decoder::evaluate(const Config & config, std::filesystem::path modelPath, c
config.print(predictedTSVFile);
std::fclose(predictedTSVFile);
std::FILE * evalFromUD = popen(fmt::format("{} {} {}", "../scripts/conll18_ud_eval.py", goldTSV, predictedTSV).c_str(), "r");
std::FILE * evalFromUD = popen(fmt::format("{} {} {} -x {}", "../scripts/conll18_ud_eval.py", goldTSV, predictedTSV, util::join(",", std::vector<std::string>(predicted.begin(), predicted.end()))).c_str(), "r");
char buffer[1024];
while (!std::feof(evalFromUD))
......
......@@ -253,7 +253,7 @@ int MacaonTrain::main()
{
BaseConfig devConfig(mcd, computeDevScore ? (devRawFile.empty() ? devTsvFile : "") : devTsvFile, devRawFile);
decoder.decode(devConfig, 1, 0.0, debug, printAdvancement);
decoder.evaluate(devConfig, modelPath, devTsvFile);
decoder.evaluate(devConfig, modelPath, devTsvFile, machine.getPredicted());
devScores = decoder.getF1Scores(machine.getPredicted());
}
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment