Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
macaon2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Alexis Nasr
macaon2
Commits
dc982296
Commit
dc982296
authored
8 years ago
by
Alexis Nasr
Browse files
Options
Downloads
Patches
Plain Diff
bug fixing
parent
18b96fe3
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
maca_trans_parser/src/maca_trans_parser_conll2fann.c
+3
-0
3 additions, 0 deletions
maca_trans_parser/src/maca_trans_parser_conll2fann.c
maca_trans_parser/src/train_perceptron.c
+12
-11
12 additions, 11 deletions
maca_trans_parser/src/train_perceptron.c
with
15 additions
and
11 deletions
maca_trans_parser/src/maca_trans_parser_conll2fann.c
+
3
−
0
View file @
dc982296
...
@@ -13,6 +13,9 @@
...
@@ -13,6 +13,9 @@
#include
"word_emb.h"
#include
"word_emb.h"
#include
"config2feat_vec.h"
#include
"config2feat_vec.h"
void
feat_vec_print_dnn
(
FILE
*
f
,
feat_vec
*
fv
,
feat_model
*
fm
,
mcd
*
m
);
void
transform_treebank_help_message
(
context
*
ctx
)
void
transform_treebank_help_message
(
context
*
ctx
)
{
{
context_general_help_message
(
ctx
);
context_general_help_message
(
ctx
);
...
...
This diff is collapsed.
Click to expand it.
maca_trans_parser/src/train_perceptron.c
+
12
−
11
View file @
dc982296
...
@@ -95,8 +95,8 @@ feature_table *train_perceptron(context *ctx)
...
@@ -95,8 +95,8 @@ feature_table *train_perceptron(context *ctx)
char
mvt_oracle_type
;
char
mvt_oracle_type
;
int
mvt_oracle_label
;
int
mvt_oracle_label
;
int
i
,
j
;
int
i
,
j
;
config
*
config_pred
;
/*
config *config_pred;
*/
int
mvt_pred_code
;
/*
int mvt_pred_code;
*/
feat_vec
*
fv
=
feat_vec_new
(
feature_types_nb
);
feat_vec
*
fv
=
feat_vec_new
(
feature_types_nb
);
sentence
*
ref
=
NULL
;
sentence
*
ref
=
NULL
;
int
sentence_nb
=
0
;
int
sentence_nb
=
0
;
...
@@ -113,7 +113,7 @@ feature_table *train_perceptron(context *ctx)
...
@@ -113,7 +113,7 @@ feature_table *train_perceptron(context *ctx)
conll_file_ref
=
myfopen
(
ctx
->
conll_filename
,
"r"
);
conll_file_ref
=
myfopen
(
ctx
->
conll_filename
,
"r"
);
config_oracle
=
config_initial
(
conll_file
,
ctx
->
mcd_struct
,
1000
,
0
);
config_oracle
=
config_initial
(
conll_file
,
ctx
->
mcd_struct
,
1000
,
0
);
config_pred
=
config_initial
(
conll_file
,
ctx
->
mcd_struct
,
1000
,
0
);
/*
config_pred = config_initial(conll_file, ctx->mcd_struct, 1000, 0);
*/
sentence_nb
=
0
;
sentence_nb
=
0
;
while
((
ref
=
sentence_read
(
conll_file_ref
,
ctx
->
mcd_struct
))
&&
(
sentence_nb
<
ctx
->
sent_nb
)){
while
((
ref
=
sentence_read
(
conll_file_ref
,
ctx
->
mcd_struct
))
&&
(
sentence_nb
<
ctx
->
sent_nb
)){
queue_read_sentence
(
config_oracle
->
bf
,
conll_file
,
ctx
->
mcd_struct
);
queue_read_sentence
(
config_oracle
->
bf
,
conll_file
,
ctx
->
mcd_struct
);
...
@@ -126,7 +126,8 @@ feature_table *train_perceptron(context *ctx)
...
@@ -126,7 +126,8 @@ feature_table *train_perceptron(context *ctx)
mvt_oracle_type
=
movement_type
(
mvt_oracle_code
);
mvt_oracle_type
=
movement_type
(
mvt_oracle_code
);
mvt_oracle_label
=
movement_label
(
mvt_oracle_code
);
mvt_oracle_label
=
movement_label
(
mvt_oracle_code
);
mvt_pred_code
=
perceptron_update
(
mvt_oracle_code
,
fv
,
ft
,
ft_sum
,
counter
++
);
/* mvt_pred_code = perceptron_update(mvt_oracle_code, fv, ft, ft_sum, counter++); */
perceptron_update
(
mvt_oracle_code
,
fv
,
ft
,
ft_sum
,
counter
++
);
if
(
mvt_oracle_type
==
MVT_LEFT
){
if
(
mvt_oracle_type
==
MVT_LEFT
){
/* printf("LEFT\n"); */
/* printf("LEFT\n"); */
...
@@ -229,8 +230,8 @@ feature_table *train_perceptron_early_update(context *ctx)
...
@@ -229,8 +230,8 @@ feature_table *train_perceptron_early_update(context *ctx)
int
mvt_oracle_label
;
int
mvt_oracle_label
;
int
i
,
j
;
int
i
,
j
;
config
*
config_pred
;
config
*
config_pred
;
int
mvt_pred_code
;
/*
int mvt_pred_code;
*/
feat_vec
*
fv
=
feat_vec_new
(
feature_types_nb
);
/*
feat_vec *fv = feat_vec_new(feature_types_nb);
*/
sentence
*
ref
=
NULL
;
sentence
*
ref
=
NULL
;
int
sentence_nb
=
0
;
int
sentence_nb
=
0
;
FILE
*
conll_file
=
NULL
;
FILE
*
conll_file
=
NULL
;
...
@@ -240,14 +241,14 @@ feature_table *train_perceptron_early_update(context *ctx)
...
@@ -240,14 +241,14 @@ feature_table *train_perceptron_early_update(context *ctx)
feature_table
*
ft
=
feature_table_new
(
1000000
,
ctx
->
mvt_nb
);
feature_table
*
ft
=
feature_table_new
(
1000000
,
ctx
->
mvt_nb
);
int
counter
=
0
;
int
counter
=
0
;
int
epoch
;
int
epoch
;
int
count_ok
=
0
;
/*
int count_ok = 0;
*/
int
count_ko
=
0
;
/*
int count_ko = 0;
*/
beam
*
current_beam
=
beam_new
(
ctx
->
beam_width
);
beam
*
current_beam
=
beam_new
(
ctx
->
beam_width
);
beam
*
next_beam
=
beam_new
(
ctx
->
beam_width
);
beam
*
next_beam
=
beam_new
(
ctx
->
beam_width
);
beam
*
final_beam
=
beam_new
(
ctx
->
beam_width
);
beam
*
final_beam
=
beam_new
(
ctx
->
beam_width
);
beam
*
tmp_beam
=
NULL
;
beam
*
tmp_beam
=
NULL
;
int
oracle_rank
;
int
oracle_rank
;
config
*
argmax
;
/*
config *argmax;
*/
for
(
epoch
=
0
;
epoch
<
ctx
->
iteration_nb
;
epoch
++
){
for
(
epoch
=
0
;
epoch
<
ctx
->
iteration_nb
;
epoch
++
){
fprintf
(
stderr
,
"[%d]"
,
epoch
+
1
);
fprintf
(
stderr
,
"[%d]"
,
epoch
+
1
);
...
@@ -354,8 +355,8 @@ feature_table *train_perceptron_early_update(context *ctx)
...
@@ -354,8 +355,8 @@ feature_table *train_perceptron_early_update(context *ctx)
int
perceptron_update
(
int
class_ref
,
feat_vec
*
fv
,
feature_table
*
ft
,
feature_table
*
ft_sum
,
int
counter
)
int
perceptron_update
(
int
class_ref
,
feat_vec
*
fv
,
feature_table
*
ft
,
feature_table
*
ft_sum
,
int
counter
)
{
{
int
classes_nb
=
ft
->
classes_nb
;
/*
int classes_nb = ft->classes_nb;
*/
int
cla
;
/*
int cla;
*/
int
argmax
;
int
argmax
;
int
feat
;
int
feat
;
float
max
;
float
max
;
...
...
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