Skip to content
Snippets Groups Projects
Commit 34c3830d authored by robin.perrotin's avatar robin.perrotin
Browse files

.

parent f20e859c
Branches
No related tags found
No related merge requests found
...@@ -155,6 +155,7 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -155,6 +155,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
double currentSumExp; double currentSumExp;
double ScoreTranslation; double ScoreTranslation;
int FlagNotInitExp; int FlagNotInitExp;
double ProbaDivider = 10; // TO SETUP
word* word_scored; word* word_scored;
...@@ -166,7 +167,7 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -166,7 +167,7 @@ void simple_decoder_parser_arc_eager(context *ctx)
sumExp = 0; sumExp = 0;
currentSumExp = 0; currentSumExp = 0;
ScoreTranslation = -10; ScoreTranslation = -10; // TO SETUP
FlagNotInitExp = 1; FlagNotInitExp = 1;
if(ctx->debug_mode){ if(ctx->debug_mode){
...@@ -200,21 +201,18 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -200,21 +201,18 @@ void simple_decoder_parser_arc_eager(context *ctx)
int b3 = respect_buffer_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code)); int b3 = respect_buffer_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code));
if(b1 && b2 && b3){ if(b1 && b2 && b3){
printf("\n*** %f %f %d %f \n",ScoreTranslation,vcode_array[i].score, i, sumExp);
if(FlagNotInitExp){ if(FlagNotInitExp){
printf(" %f %f %d $$$$$$\n",ScoreTranslation,vcode_array[i].score, i); ScoreTranslation += vcode_array[i].score/ProbaDivider;
ScoreTranslation += vcode_array[i].score;
printf(" %f $$$$$$\n" ,ScoreTranslation);
FlagNotInitExp = 0; FlagNotInitExp = 0;
} }
if(vcode_array[i].score - ScoreTranslation > 0){ if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
sumExp += exp(vcode_array[i].score - ScoreTranslation); sumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
} }
} }
} }
currentSumExp = 0.; currentSumExp = 0.;
for(int i=0; i < ft->classes_nb && i < 1000; i++){ for(int i=0; i < ft->classes_nb && i < 10; i++){
printf("%d\t", i); printf("%d\t", i);
movement_parser_print(stdout, vcode_array[i].class_code, ctx->dico_labels); movement_parser_print(stdout, vcode_array[i].class_code, ctx->dico_labels);
printf("\t%.4f", vcode_array[i].score); printf("\t%.4f", vcode_array[i].score);
...@@ -223,10 +221,10 @@ void simple_decoder_parser_arc_eager(context *ctx) ...@@ -223,10 +221,10 @@ void simple_decoder_parser_arc_eager(context *ctx)
int b2 = respect_stack_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code)); int b2 = respect_stack_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code));
int b3 = respect_buffer_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code)); int b3 = respect_buffer_constraint(ctx->partial_mode, c, movement_parser_type(vcode_array[i].class_code), movement_parser_label(vcode_array[i].class_code));
if(b1 && b2 && b3){ if(b1 && b2 && b3){
if(vcode_array[i].score - ScoreTranslation > 0){ if(vcode_array[i].score/ProbaDivider - ScoreTranslation > 0){
printf(" %f %f %f",sumExp, currentSumExp,ScoreTranslation); printf(" %f %f %f",sumExp, currentSumExp,ScoreTranslation);
printf(" [%f-",currentSumExp/sumExp); printf(" [%f-",currentSumExp/sumExp);
currentSumExp += exp(vcode_array[i].score - ScoreTranslation); currentSumExp += exp(vcode_array[i].score/ProbaDivider - ScoreTranslation);
printf("%f[", currentSumExp/sumExp); printf("%f[", currentSumExp/sumExp);
} }
printf("\t<----"); printf("\t<----");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment