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

Aggregate the metric a bit more

parent cc486b25
......@@ -21,7 +21,7 @@ static size_t n_hidden_layers;
static size_t *hidden_sizes;
static double learning_rate;
static double exploration;
static double metric;
static double metric = 0;
static int cont = 0;
static struct yarrow256_ctx generator;
......@@ -231,21 +231,19 @@ custom_ai_learn (void *data, const TarotGame * base,
TarotGameEvent *evaluated = (TarotGameEvent *) event;
double diff;
static int has_metric = 0;
double frac;
tarot_perceptron_eval (p, base, 1, &evaluated, 0, 1, &predicted);
diff = final_score - predicted;
if (diff < 0)
{
diff = -diff;
}
if (!has_metric)
if (has_metric < 1000000)
{
metric = diff;
has_metric = 1;
}
else
{
metric = 0.999 * metric + 0.001 * diff;
has_metric++;
}
frac = 1.0 / has_metric;
metric = (1 - frac) * metric + frac * diff;
tarot_perceptron_learn (p, base, event, final_score);
}
......
Markdown is supported
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