Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Franck Dary
macaon
Commits
4818cfc8
Commit
4818cfc8
authored
Jan 12, 2022
by
Franck Dary
Browse files
Giving MCD to the eval script
parent
dfd75ada
Changes
3
Hide whitespace changes
Inline
Side-by-side
decoder/include/Decoder.hpp
View file @
4818cfc8
...
...
@@ -26,7 +26,7 @@ class Decoder
Decoder
(
ReadingMachine
&
machine
);
std
::
size_t
decode
(
BaseConfig
&
config
,
std
::
size_t
beamSize
,
float
beamThreshold
,
bool
debug
,
bool
printAdvancement
);
void
evaluate
(
const
std
::
vector
<
const
Config
*>
&
configs
,
std
::
filesystem
::
path
modelPath
,
const
std
::
string
goldTSV
,
const
std
::
set
<
std
::
string
>
&
predicted
);
void
evaluate
(
const
std
::
vector
<
const
Config
*>
&
configs
,
std
::
filesystem
::
path
modelPath
,
const
std
::
string
goldTSV
,
const
std
::
set
<
std
::
string
>
&
predicted
,
std
::
string
mcd
);
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
;
...
...
decoder/src/Decoder.cpp
View file @
4818cfc8
...
...
@@ -135,7 +135,7 @@ std::string Decoder::getMetricOfColName(const std::string & colName) const
return
colName
;
}
void
Decoder
::
evaluate
(
const
std
::
vector
<
const
Config
*>
&
configs
,
std
::
filesystem
::
path
modelPath
,
const
std
::
string
goldTSV
,
const
std
::
set
<
std
::
string
>
&
predicted
)
void
Decoder
::
evaluate
(
const
std
::
vector
<
const
Config
*>
&
configs
,
std
::
filesystem
::
path
modelPath
,
const
std
::
string
goldTSV
,
const
std
::
set
<
std
::
string
>
&
predicted
,
std
::
string
mcd
)
{
evaluation
.
clear
();
auto
predictedTSV
=
(
modelPath
/
"predicted_dev.tsv"
).
string
();
...
...
@@ -144,7 +144,7 @@ void Decoder::evaluate(const std::vector<const Config *> & configs, std::filesys
configs
[
i
]
->
print
(
predictedTSVFile
,
i
==
0
);
std
::
fclose
(
predictedTSVFile
);
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"
);
std
::
FILE
*
evalFromUD
=
popen
(
fmt
::
format
(
"{} {} {} -x
{} --mcd
{}"
,
"../scripts/conll18_ud_eval.py"
,
goldTSV
,
predictedTSV
,
util
::
join
(
","
,
std
::
vector
<
std
::
string
>
(
predicted
.
begin
(),
predicted
.
end
()))
,
mcd
).
c_str
(),
"r"
);
char
buffer
[
1024
];
while
(
!
std
::
feof
(
evalFromUD
))
...
...
trainer/src/MacaonTrain.cpp
View file @
4818cfc8
...
...
@@ -345,7 +345,7 @@ int MacaonTrain::main()
std
::
vector
<
const
Config
*>
devConfigsPtrs
;
for
(
auto
&
devConfig
:
devConfigs
)
devConfigsPtrs
.
emplace_back
(
&
devConfig
);
decoder
.
evaluate
(
devConfigsPtrs
,
modelPath
,
devTsvFile
,
machine
.
getPredicted
());
decoder
.
evaluate
(
devConfigsPtrs
,
modelPath
,
devTsvFile
,
machine
.
getPredicted
()
,
mcd
);
devScores
=
decoder
.
getF1Scores
(
machine
.
getPredicted
());
}
else
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment