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

Add some randomization during the initialization

If I keep the weak initialization, then we won't be able to use 2/3 of
the hidden neurons, because the initial weights are cyclic.
parent 7b522545
......@@ -8,7 +8,7 @@ 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:07+0100\n"
"POT-Creation-Date: 2019-11-27 08:08+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"
......@@ -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:71
#: src/tarot-app/tarot_perceptron_bootstrap.c:82
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:108
#: src/tarot-app/tarot_perceptron_bootstrap.c:119
#, 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:70
#: src/tarot-app/tarot_perceptron_bootstrap.c:81
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:74
#: src/tarot-app/tarot_perceptron_bootstrap.c:85
msgid "seed"
msgstr "graine"
......@@ -1573,20 +1573,20 @@ msgstr "Poignée"
msgid "Discarding"
msgstr "Écart"
#: src/tarot-app/tarot_perceptron_bootstrap.c:47
#: src/tarot-app/tarot_perceptron_bootstrap.c:58
#, 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:72
#: src/tarot-app/tarot_perceptron_bootstrap.c:83
msgid "learning-rate"
msgstr "taux-d-apprentissage"
#: src/tarot-app/tarot_perceptron_bootstrap.c:73
#: src/tarot-app/tarot_perceptron_bootstrap.c:84
msgid "exploration"
msgstr "exploration"
#: src/tarot-app/tarot_perceptron_bootstrap.c:95
#: src/tarot-app/tarot_perceptron_bootstrap.c:106
#, c-format
msgid ""
"Usage: tarot-perceptron-bootstrap [OPTIONS]... [HIDDEN_SIZE]...\n"
......@@ -1607,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:120
#: src/tarot-app/tarot_perceptron_bootstrap.c:131
#, 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:132
#: src/tarot-app/tarot_perceptron_bootstrap.c:143
#, c-format
msgid ""
"Error: the exploration probability should be a probability (between 0 and "
......@@ -1623,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:143
#: src/tarot-app/tarot_perceptron_bootstrap.c:154
#, 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:172
#: src/tarot-app/tarot_perceptron_bootstrap.c:183
#, c-format
msgid ""
"Error: the %d-th dimension should be a strictly positive integer, not '%s'.\n"
......
......@@ -40,7 +40,18 @@ main (int argc, char *argv[])
tarot_perceptron_save_alloc (perceptron, &n_weights, &weights);
for (i = 0; i < n_weights; i++)
{
weights[i] *= 1000;
/* We also need to add some random noise, because the
* initialization is weak */
double mini = 800;
double maxi = 1200;
size_t random_n;
size_t random_max = (size_t) (-1);
uint8_t random_data[sizeof (random_n)];
double t = 0;
yarrow256_random (&generator, sizeof (random_data), random_data);
memcpy (&random_n, random_data, sizeof (random_data));
t = ((double) random_n) / ((double) random_max);
weights[i] *= (mini * (1 - t) + maxi * t);
}
tarot_perceptron_load (perceptron, 0, n_weights, weights);
free (weights);
......
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