Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
old_macaon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
old_macaon
Commits
05958f77
Commit
05958f77
authored
Jun 26, 2019
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Improved featureExtraction
parent
5fd8f5e6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
trainer/src/Trainer.cpp
+3
-3
3 additions, 3 deletions
trainer/src/Trainer.cpp
transition_machine/include/FeatureModel.hpp
+5
-0
5 additions, 0 deletions
transition_machine/include/FeatureModel.hpp
transition_machine/src/FeatureModel.cpp
+4
-2
4 additions, 2 deletions
transition_machine/src/FeatureModel.cpp
with
12 additions
and
5 deletions
trainer/src/Trainer.cpp
+
3
−
3
View file @
05958f77
...
@@ -83,7 +83,7 @@ void Trainer::computeScoreOnDev()
...
@@ -83,7 +83,7 @@ void Trainer::computeScoreOnDev()
else
else
{
{
// Print current iter advancement in percentage
// Print current iter advancement in percentage
if
(
ProgramParameters
::
interactive
&&
!
ProgramParameters
::
featureExtraction
)
if
(
ProgramParameters
::
interactive
)
{
{
int
totalSize
=
ProgramParameters
::
devTapeSize
;
int
totalSize
=
ProgramParameters
::
devTapeSize
;
int
steps
=
devConfig
->
getHead
();
int
steps
=
devConfig
->
getHead
();
...
@@ -223,7 +223,7 @@ void Trainer::doStepTrain()
...
@@ -223,7 +223,7 @@ void Trainer::doStepTrain()
}
}
// Print current iter advancement in percentage
// Print current iter advancement in percentage
if
(
ProgramParameters
::
interactive
&&
!
ProgramParameters
::
featureExtraction
)
if
(
ProgramParameters
::
interactive
)
{
{
int
totalSize
=
ProgramParameters
::
iterationSize
==
-
1
?
ProgramParameters
::
tapeSize
:
ProgramParameters
::
iterationSize
;
int
totalSize
=
ProgramParameters
::
iterationSize
==
-
1
?
ProgramParameters
::
tapeSize
:
ProgramParameters
::
iterationSize
;
int
steps
=
ProgramParameters
::
iterationSize
==
-
1
?
trainConfig
.
getHead
()
:
nbSteps
;
int
steps
=
ProgramParameters
::
iterationSize
==
-
1
?
trainConfig
.
getHead
()
:
nbSteps
;
...
@@ -298,7 +298,7 @@ void Trainer::doStepTrain()
...
@@ -298,7 +298,7 @@ void Trainer::doStepTrain()
if
(
ProgramParameters
::
featureExtraction
)
if
(
ProgramParameters
::
featureExtraction
)
{
{
auto
features
=
tm
.
getCurrentClassifier
()
->
getFeatureModel
()
->
getFeatureDescription
(
trainConfig
).
featureValues
();
auto
features
=
tm
.
getCurrentClassifier
()
->
getFeatureModel
()
->
getFeatureDescription
(
trainConfig
).
featureValues
();
fprintf
(
stdout
,
"%s
\t
%s
\
n
"
,
oAction
.
c_str
(),
features
.
c_str
());
fprintf
(
stdout
,
"%s
\t
%s
\
t
%s
\n
"
,
tm
.
getCurrentClassifier
()
->
getFeatureModel
()
->
filename
.
c_str
()
,
oAction
.
c_str
(),
features
.
c_str
());
}
}
if
(
TI
.
getEpoch
()
>=
k
&&
choiceWithProbability
(
ProgramParameters
::
dynamicProbability
))
if
(
TI
.
getEpoch
()
>=
k
&&
choiceWithProbability
(
ProgramParameters
::
dynamicProbability
))
...
...
This diff is collapsed.
Click to expand it.
transition_machine/include/FeatureModel.hpp
+
5
−
0
View file @
05958f77
...
@@ -103,6 +103,11 @@ class FeatureModel
...
@@ -103,6 +103,11 @@ class FeatureModel
public
:
public
:
/// @brief The name of the FeatureModel file.
std
::
string
filename
;
public
:
/// @brief Tranform a Policy into the corresponding string.
/// @brief Tranform a Policy into the corresponding string.
///
///
/// @param policy The Policy.
/// @param policy The Policy.
...
...
This diff is collapsed.
Click to expand it.
transition_machine/src/FeatureModel.cpp
+
4
−
2
View file @
05958f77
...
@@ -21,6 +21,8 @@ FeatureModel::FeatureDescription & FeatureModel::getFeatureDescription(Config &
...
@@ -21,6 +21,8 @@ FeatureModel::FeatureDescription & FeatureModel::getFeatureDescription(Config &
FeatureModel
::
FeatureModel
(
const
std
::
string
&
filename
)
FeatureModel
::
FeatureModel
(
const
std
::
string
&
filename
)
{
{
this
->
filename
=
getFilenameFromPath
(
filename
);
File
file
(
filename
,
"r"
);
File
file
(
filename
,
"r"
);
FILE
*
fd
=
file
.
getDescriptor
();
FILE
*
fd
=
file
.
getDescriptor
();
char
buffer
[
1024
];
char
buffer
[
1024
];
...
@@ -141,8 +143,8 @@ std::string FeatureModel::FeatureDescription::featureValues()
...
@@ -141,8 +143,8 @@ std::string FeatureModel::FeatureDescription::featureValues()
std
::
string
res
;
std
::
string
res
;
for
(
auto
&
feature
:
values
)
for
(
auto
&
feature
:
values
)
for
(
auto
&
value
:
feature
.
values
)
for
(
unsigned
int
i
=
0
;
i
<
feature
.
values
.
size
();
i
++
)
res
+=
value
+
"
\t
"
;
res
+=
feature
.
values
[
i
]
+
(
i
==
feature
.
values
.
size
()
-
1
?
"
\t
"
:
" "
)
;
if
(
!
res
.
empty
())
if
(
!
res
.
empty
())
res
.
pop_back
();
res
.
pop_back
();
...
...
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