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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Franck Dary
old_macaon
Commits
ed77c3a7
Commit
ed77c3a7
authored
6 years ago
by
Franck Dary
Browse files
Options
Downloads
Patches
Plain Diff
Fixed error related to unused default actions
parent
957d17c8
No related branches found
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
+4
-0
4 additions, 0 deletions
trainer/src/Trainer.cpp
transition_machine/include/Classifier.hpp
+4
-0
4 additions, 0 deletions
transition_machine/include/Classifier.hpp
transition_machine/src/Classifier.cpp
+8
-0
8 additions, 0 deletions
transition_machine/src/Classifier.cpp
with
16 additions
and
0 deletions
trainer/src/Trainer.cpp
+
4
−
0
View file @
ed77c3a7
...
@@ -233,6 +233,9 @@ void Trainer::train()
...
@@ -233,6 +233,9 @@ void Trainer::train()
if
(
pAction
==
oAction
)
if
(
pAction
==
oAction
)
pActionIsZeroCost
=
true
;
pActionIsZeroCost
=
true
;
if
(
oAction
.
empty
())
oAction
=
tm
.
getCurrentClassifier
()
->
getDefaultAction
();
if
(
oAction
.
empty
())
if
(
oAction
.
empty
())
{
{
if
(
trainConfig
.
endOfTapes
())
if
(
trainConfig
.
endOfTapes
())
...
@@ -241,6 +244,7 @@ void Trainer::train()
...
@@ -241,6 +244,7 @@ void Trainer::train()
trainConfig
.
stackPop
();
trainConfig
.
stackPop
();
break
;
break
;
}
}
fprintf
(
stderr
,
"ERROR (%s) : Unable to find any zero cost action. Aborting.
\n
"
,
ERRINFO
);
fprintf
(
stderr
,
"ERROR (%s) : Unable to find any zero cost action. Aborting.
\n
"
,
ERRINFO
);
fprintf
(
stderr
,
"State : %s
\n
"
,
tm
.
getCurrentState
().
c_str
());
fprintf
(
stderr
,
"State : %s
\n
"
,
tm
.
getCurrentState
().
c_str
());
trainConfig
.
printForDebug
(
stderr
);
trainConfig
.
printForDebug
(
stderr
);
...
...
This diff is collapsed.
Click to expand it.
transition_machine/include/Classifier.hpp
+
4
−
0
View file @
ed77c3a7
...
@@ -77,6 +77,10 @@ class Classifier
...
@@ -77,6 +77,10 @@ class Classifier
public
:
public
:
/// @brief If the ActionScript has a default action, get it.
///
/// @return The default action name, or an empty string.
std
::
string
getDefaultAction
()
const
;
/// @brief Return how many errors will an action introduce.
/// @brief Return how many errors will an action introduce.
///
///
/// @param config The current config.
/// @param config The current config.
...
...
This diff is collapsed.
Click to expand it.
transition_machine/src/Classifier.cpp
+
8
−
0
View file @
ed77c3a7
...
@@ -260,6 +260,14 @@ std::vector<std::string> Classifier::getZeroCostActions(Config & config)
...
@@ -260,6 +260,14 @@ std::vector<std::string> Classifier::getZeroCostActions(Config & config)
return
result
;
return
result
;
}
}
std
::
string
Classifier
::
getDefaultAction
()
const
{
if
(
as
->
hasDefaultAction
)
return
as
->
getActionName
(
0
);
return
std
::
string
();
}
float
Classifier
::
trainOnExample
(
Config
&
config
,
int
gold
)
float
Classifier
::
trainOnExample
(
Config
&
config
,
int
gold
)
{
{
auto
fd
=
fm
->
getFeatureDescription
(
config
);
auto
fd
=
fm
->
getFeatureDescription
(
config
);
...
...
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