Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tarot
tarot
Commits
e3a5f636
Commit
e3a5f636
authored
Dec 15, 2019
by
Vivien Kraus
Browse files
Aggregate the metric a bit more
parent
cc486b25
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tarot-app/tarot_perceptron_bootstrap.c
View file @
e3a5f636
...
...
@@ -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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment