Commit 43109655 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Print the models rarely

parent e5849ef7
......@@ -456,43 +456,40 @@ self_learn (TarotPerceptron * perceptron)
}
}
metric = tarot_perceptron_validate (perceptron, game);
if (--until_print_game == 0)
{
if (!is_empty_game (game))
{
double *data = NULL, max_weight = 0;
double *weights = NULL, max_weight = 0;
size_t n = 0, w;
double update = tarot_perceptron_learn_game (perceptron, game);
tarot_perceptron_save_alloc (perceptron, &n, &data);
char *xml = tarot_game_save_to_xml_alloc (game);
tarot_perceptron_save_alloc (perceptron, &n, &weights);
for (w = 0; w < n; w++)
{
if (w != 0)
{
printf ("\t");
}
printf ("%f", data[w]);
if (data[w] > max_weight || -data[w] > max_weight)
printf ("%f", weights[w]);
if (weights[w] > max_weight || -weights[w] > max_weight)
{
if (data[w] > max_weight)
if (weights[w] > max_weight)
{
max_weight = data[w];
max_weight = weights[w];
}
else
{
max_weight = -data[w];
max_weight = -weights[w];
}
}
}
printf ("\n");
fprintf (stderr, "%g\t%g\t%g\t%g\n", current_exploration, update,
metric, max_weight);
free (data);
}
if (--until_print_game == 0)
{
if (!is_empty_game (game))
{
char *data = tarot_game_save_to_xml_alloc (game);
fprintf (stderr, "%s\n", data);
free (data);
free (weights);
fprintf (stderr, "%s\n", xml);
free (xml);
}
until_print_game = 100;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment