Commit 1af99375 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Print the weights for each iteration

parent 9d7320ce
......@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: tarot 0.4.2.83-ebdc-dirty\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
"POT-Creation-Date: 2019-11-27 08:04+0100\n"
"PO-Revision-Date: 2019-11-24 17:44+0100\n"
"POT-Creation-Date: 2019-11-27 08:07+0100\n"
"PO-Revision-Date: 2019-11-26 20:11+0100\n"
"Last-Translator: Vivien Kraus <vivien@planete-kraus.eu>\n"
"Language-Team: French\n"
"Language: fr\n"
......@@ -48,7 +48,7 @@ msgstr "Affiche l'information de version et quitte"
#: src/tarot-app/tarot_deal.c:70 src/tarot-app/tarot_mcts.c:88
#: src/tarot-app/tarot_stacking.c:80 src/tarot-app/tarot_features.c:62
#: src/tarot-app/tarot_cnn_features.c:58
#: src/tarot-app/tarot_perceptron_bootstrap.c:60
#: src/tarot-app/tarot_perceptron_bootstrap.c:61
msgid "version"
msgstr "version"
......@@ -56,7 +56,7 @@ msgstr "version"
#: src/tarot-app/tarot_deal.c:112 src/tarot-app/tarot_mcts.c:136
#: src/tarot-app/tarot_stacking.c:112 src/tarot-app/tarot_features.c:93
#: src/tarot-app/tarot_cnn_features.c:89
#: src/tarot-app/tarot_perceptron_bootstrap.c:97
#: src/tarot-app/tarot_perceptron_bootstrap.c:98
#, c-format
msgid ""
"%s (libtarot %s)\n"
......@@ -1205,7 +1205,7 @@ msgstr ""
#: src/tarot-app/tarot_deal.c:69 src/tarot-app/tarot_mcts.c:87
#: src/tarot-app/tarot_stacking.c:79 src/tarot-app/tarot_features.c:61
#: src/tarot-app/tarot_cnn_features.c:57
#: src/tarot-app/tarot_perceptron_bootstrap.c:59
#: src/tarot-app/tarot_perceptron_bootstrap.c:60
msgid "help"
msgstr "aide"
......@@ -1222,7 +1222,7 @@ msgid "no-call-allowed"
msgstr "appel-interdit"
#: src/tarot-app/tarot_deal.c:74 src/tarot-app/tarot_mcts.c:90
#: src/tarot-app/tarot_perceptron_bootstrap.c:63
#: src/tarot-app/tarot_perceptron_bootstrap.c:64
msgid "seed"
msgstr "graine"
......@@ -1573,15 +1573,20 @@ msgstr "Poignée"
msgid "Discarding"
msgstr "Écart"
#: src/tarot-app/tarot_perceptron_bootstrap.c:61
#: src/tarot-app/tarot_perceptron_bootstrap.c:37
#, c-format
msgid "Mean update\tValidation score\tMaximum weight\n"
msgstr "Mise à jour moyenne\\tScore de validation\\tPoids maximum\n"
#: src/tarot-app/tarot_perceptron_bootstrap.c:62
msgid "learning-rate"
msgstr "taux-d-apprentissage"
#: src/tarot-app/tarot_perceptron_bootstrap.c:62
#: src/tarot-app/tarot_perceptron_bootstrap.c:63
msgid "exploration"
msgstr "exploration"
#: src/tarot-app/tarot_perceptron_bootstrap.c:84
#: src/tarot-app/tarot_perceptron_bootstrap.c:85
#, c-format
msgid ""
"Usage: tarot-perceptron-bootstrap [OPTIONS]... [HIDDEN_SIZE]...\n"
......@@ -1602,14 +1607,14 @@ msgstr ""
"- -s GRAINE, --seed=GRAINE : définit la graine aléatoire. GRAINE ne\n"
" peut pas être une chaîne vide.\n"
#: src/tarot-app/tarot_perceptron_bootstrap.c:109
#: src/tarot-app/tarot_perceptron_bootstrap.c:110
#, c-format
msgid "Error: the learning rate should be a positive number, not '%s'.\n"
msgstr ""
"Erreur : le taux d'apprentissage doit être un nombre positif, et pas "
"« %s ».\n"
#: src/tarot-app/tarot_perceptron_bootstrap.c:121
#: src/tarot-app/tarot_perceptron_bootstrap.c:122
#, c-format
msgid ""
"Error: the exploration probability should be a probability (between 0 and "
......@@ -1618,12 +1623,12 @@ msgstr ""
"Erreur : la probabilité d'exploration doit être une probabilité (entre\n"
"0 et 1), et pas « %s ».\n"
#: src/tarot-app/tarot_perceptron_bootstrap.c:132
#: src/tarot-app/tarot_perceptron_bootstrap.c:133
#, c-format
msgid "Error: the seed must not be empty.\n"
msgstr "Erreur : la graine ne doit pas être vide.\n"
#: src/tarot-app/tarot_perceptron_bootstrap.c:161
#: src/tarot-app/tarot_perceptron_bootstrap.c:162
#, c-format
msgid ""
"Error: the %d-th dimension should be a strictly positive integer, not '%s'.\n"
......
......@@ -34,6 +34,7 @@ main (int argc, char *argv[])
parse_options (argc, argv);
perceptron =
tarot_perceptron_alloc (n_hidden_layers, hidden_sizes, learning_rate);
fprintf (stderr, _("Mean update\tValidation score\tMaximum weight\n"));
while (1)
{
self_learn (perceptron);
......@@ -308,8 +309,32 @@ self_learn (TarotPerceptron * perceptron)
metric = tarot_perceptron_validate (perceptron, game);
if (!is_empty_game (game))
{
double *data = NULL, max_weight = 0;
size_t n = 0, w;
update = tarot_perceptron_learn_game (perceptron, game);
fprintf (stderr, "%g\t%g\n", update, metric);
tarot_perceptron_save_alloc (perceptron, &n, &data);
for (w = 0; w < n; w++)
{
if (w != 0)
{
printf ("\t");
}
printf ("%f", data[w]);
if (data[w] > max_weight || -data[w] > max_weight)
{
if (data[w] > max_weight)
{
max_weight = data[w];
}
else
{
max_weight = -data[w];
}
}
}
printf ("\n");
fprintf (stderr, "%g\t%g\t%g\n", update, metric, max_weight);
free (data);
}
tarot_game_free (game);
}
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