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
9d7a334b
Commit
9d7a334b
authored
5 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Fixed Config's evaluation
parent
5cd7a36f
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
common/include/util.hpp
+2
-0
2 additions, 0 deletions
common/include/util.hpp
common/src/util.cpp
+19
-0
19 additions, 0 deletions
common/src/util.cpp
decoder/src/Decoder.cpp
+7
-5
7 additions, 5 deletions
decoder/src/Decoder.cpp
dev/src/dev.cpp
+1
-1
1 addition, 1 deletion
dev/src/dev.cpp
with
29 additions
and
6 deletions
common/include/util.hpp
+
2
−
0
View file @
9d7a334b
...
@@ -43,6 +43,8 @@ std::string int2HumanStr(int number);
...
@@ -43,6 +43,8 @@ std::string int2HumanStr(int number);
std
::
string
shrink
(
const
std
::
string
&
s
,
int
printedSize
);
std
::
string
shrink
(
const
std
::
string
&
s
,
int
printedSize
);
std
::
string
strip
(
const
std
::
string
&
s
);
int
printedLength
(
std
::
string_view
s
);
int
printedLength
(
std
::
string_view
s
);
bool
isSeparator
(
utf8char
c
);
bool
isSeparator
(
utf8char
c
);
...
...
This diff is collapsed.
Click to expand it.
common/src/util.cpp
+
19
−
0
View file @
9d7a334b
...
@@ -153,3 +153,22 @@ bool util::doIfNameMatch(const std::regex & reg, std::string_view name, const st
...
@@ -153,3 +153,22 @@ bool util::doIfNameMatch(const std::regex & reg, std::string_view name, const st
return
true
;
return
true
;
}
}
//TODO : test this
std
::
string
util
::
strip
(
const
std
::
string
&
s
)
{
std
::
string
striped
;
if
(
s
.
empty
())
return
striped
;
std
::
size_t
first
=
0
;
while
(
first
<
s
.
size
()
and
(
s
[
first
]
==
' '
or
s
[
first
]
==
'\t'
))
++
first
;
std
::
size_t
last
=
s
.
size
()
-
1
;
while
(
last
>
first
and
(
s
[
last
]
==
' '
or
s
[
last
]
==
'\t'
))
--
last
;
return
std
::
string
(
s
.
begin
()
+
first
,
s
.
begin
()
+
last
+
1
);
}
This diff is collapsed.
Click to expand it.
decoder/src/Decoder.cpp
+
7
−
5
View file @
9d7a334b
...
@@ -97,17 +97,19 @@ void Decoder::evaluate(const Config & config, std::filesystem::path modelPath, c
...
@@ -97,17 +97,19 @@ void Decoder::evaluate(const Config & config, std::filesystem::path modelPath, c
if
(
util
::
doIfNameMatch
(
std
::
regex
(
"(.*)
\\
|(.*)
\\
|(.*)
\\
|(.*)
\\
|(.*)"
),
buffer
,
[
this
,
buffer
](
auto
sm
)
if
(
util
::
doIfNameMatch
(
std
::
regex
(
"(.*)
\\
|(.*)
\\
|(.*)
\\
|(.*)
\\
|(.*)"
),
buffer
,
[
this
,
buffer
](
auto
sm
)
{
{
for
(
unsigned
int
i
=
0
;
i
<
this
->
evaluation
[
sm
[
1
]].
size
();
i
++
)
auto
metric
=
util
::
strip
(
sm
[
1
]);
for
(
unsigned
int
i
=
0
;
i
<
this
->
evaluation
[
metric
].
size
();
i
++
)
{
{
if
(
std
::
string
(
sm
[
i
+
2
]).
empty
())
auto
value
=
util
::
strip
(
sm
[
i
+
2
]);
if
(
value
.
empty
())
{
{
this
->
evaluation
[
sm
[
1
]
][
i
]
=
0.0
;
this
->
evaluation
[
metric
][
i
]
=
0.0
;
continue
;
continue
;
}
}
try
{
this
->
evaluation
[
sm
[
1
]
][
i
]
=
std
::
stof
(
sm
[
i
+
2
]
);}
try
{
this
->
evaluation
[
metric
][
i
]
=
std
::
stof
(
value
);}
catch
(
std
::
exception
&
)
catch
(
std
::
exception
&
)
{
{
util
::
myThrow
(
fmt
::
format
(
"score '{}' is not a number in line '{}'"
,
std
::
string
(
sm
[
i
+
2
])
,
buffer
));
util
::
myThrow
(
fmt
::
format
(
"score '{}' is not a number in line '{}'"
,
value
,
buffer
));
}
}
}
}
})){}
})){}
...
...
This diff is collapsed.
Click to expand it.
dev/src/dev.cpp
+
1
−
1
View file @
9d7a334b
...
@@ -35,7 +35,7 @@ int main(int argc, char * argv[])
...
@@ -35,7 +35,7 @@ int main(int argc, char * argv[])
Decoder
decoder
(
machine
);
Decoder
decoder
(
machine
);
int
nbEpoch
=
1
;
int
nbEpoch
=
1
0
;
for
(
int
i
=
0
;
i
<
nbEpoch
;
i
++
)
for
(
int
i
=
0
;
i
<
nbEpoch
;
i
++
)
{
{
...
...
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