Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
macaon
Commits
4818cfc8
Commit
4818cfc8
authored
3 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Giving MCD to the eval script
parent
dfd75ada
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
decoder/include/Decoder.hpp
+1
-1
1 addition, 1 deletion
decoder/include/Decoder.hpp
decoder/src/Decoder.cpp
+2
-2
2 additions, 2 deletions
decoder/src/Decoder.cpp
trainer/src/MacaonTrain.cpp
+1
-1
1 addition, 1 deletion
trainer/src/MacaonTrain.cpp
with
4 additions
and
4 deletions
decoder/include/Decoder.hpp
+
1
−
1
View file @
4818cfc8
...
@@ -26,7 +26,7 @@ class Decoder
...
@@ -26,7 +26,7 @@ class Decoder
Decoder
(
ReadingMachine
&
machine
);
Decoder
(
ReadingMachine
&
machine
);
std
::
size_t
decode
(
BaseConfig
&
config
,
std
::
size_t
beamSize
,
float
beamThreshold
,
bool
debug
,
bool
printAdvancement
);
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
>>
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
>>
getAlignedAccs
(
const
std
::
set
<
std
::
string
>
&
colNames
)
const
;
std
::
vector
<
std
::
pair
<
float
,
std
::
string
>>
getRecalls
(
const
std
::
set
<
std
::
string
>
&
colNames
)
const
;
std
::
vector
<
std
::
pair
<
float
,
std
::
string
>>
getRecalls
(
const
std
::
set
<
std
::
string
>
&
colNames
)
const
;
...
...
This diff is collapsed.
Click to expand it.
decoder/src/Decoder.cpp
+
2
−
2
View file @
4818cfc8
...
@@ -135,7 +135,7 @@ std::string Decoder::getMetricOfColName(const std::string & colName) const
...
@@ -135,7 +135,7 @@ std::string Decoder::getMetricOfColName(const std::string & colName) const
return
colName
;
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
();
evaluation
.
clear
();
auto
predictedTSV
=
(
modelPath
/
"predicted_dev.tsv"
).
string
();
auto
predictedTSV
=
(
modelPath
/
"predicted_dev.tsv"
).
string
();
...
@@ -144,7 +144,7 @@ void Decoder::evaluate(const std::vector<const Config *> & configs, std::filesys
...
@@ -144,7 +144,7 @@ void Decoder::evaluate(const std::vector<const Config *> & configs, std::filesys
configs
[
i
]
->
print
(
predictedTSVFile
,
i
==
0
);
configs
[
i
]
->
print
(
predictedTSVFile
,
i
==
0
);
std
::
fclose
(
predictedTSVFile
);
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
];
char
buffer
[
1024
];
while
(
!
std
::
feof
(
evalFromUD
))
while
(
!
std
::
feof
(
evalFromUD
))
...
...
This diff is collapsed.
Click to expand it.
trainer/src/MacaonTrain.cpp
+
1
−
1
View file @
4818cfc8
...
@@ -345,7 +345,7 @@ int MacaonTrain::main()
...
@@ -345,7 +345,7 @@ int MacaonTrain::main()
std
::
vector
<
const
Config
*>
devConfigsPtrs
;
std
::
vector
<
const
Config
*>
devConfigsPtrs
;
for
(
auto
&
devConfig
:
devConfigs
)
for
(
auto
&
devConfig
:
devConfigs
)
devConfigsPtrs
.
emplace_back
(
&
devConfig
);
devConfigsPtrs
.
emplace_back
(
&
devConfig
);
decoder
.
evaluate
(
devConfigsPtrs
,
modelPath
,
devTsvFile
,
machine
.
getPredicted
());
decoder
.
evaluate
(
devConfigsPtrs
,
modelPath
,
devTsvFile
,
machine
.
getPredicted
()
,
mcd
);
devScores
=
decoder
.
getF1Scores
(
machine
.
getPredicted
());
devScores
=
decoder
.
getF1Scores
(
machine
.
getPredicted
());
}
}
else
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment