Skip to content
GitLab
Menu
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
43109655
Commit
43109655
authored
Dec 04, 2019
by
Vivien Kraus
Browse files
Print the models rarely
parent
e5849ef7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/tarot-app/tarot_perceptron_bootstrap.c
View file @
43109655
...
@@ -456,44 +456,41 @@ self_learn (TarotPerceptron * perceptron)
...
@@ -456,44 +456,41 @@ self_learn (TarotPerceptron * perceptron)
}
}
}
}
metric
=
tarot_perceptron_validate
(
perceptron
,
game
);
metric
=
tarot_perceptron_validate
(
perceptron
,
game
);
if
(
!
is_empty_game
(
game
))
{
double
*
data
=
NULL
,
max_weight
=
0
;
size_t
n
=
0
,
w
;
double
update
=
tarot_perceptron_learn_game
(
perceptron
,
game
);
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
\t
%g
\n
"
,
current_exploration
,
update
,
metric
,
max_weight
);
free
(
data
);
}
if
(
--
until_print_game
==
0
)
if
(
--
until_print_game
==
0
)
{
{
if
(
!
is_empty_game
(
game
))
if
(
!
is_empty_game
(
game
))
{
{
char
*
data
=
tarot_game_save_to_xml_alloc
(
game
);
double
*
weights
=
NULL
,
max_weight
=
0
;
fprintf
(
stderr
,
"%s
\n
"
,
data
);
size_t
n
=
0
,
w
;
free
(
data
);
double
update
=
tarot_perceptron_learn_game
(
perceptron
,
game
);
}
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"
,
weights
[
w
]);
if
(
weights
[
w
]
>
max_weight
||
-
weights
[
w
]
>
max_weight
)
{
if
(
weights
[
w
]
>
max_weight
)
{
max_weight
=
weights
[
w
];
}
else
{
max_weight
=
-
weights
[
w
];
}
}
}
printf
(
"
\n
"
);
fprintf
(
stderr
,
"%g
\t
%g
\t
%g
\t
%g
\n
"
,
current_exploration
,
update
,
metric
,
max_weight
);
free
(
weights
);
fprintf
(
stderr
,
"%s
\n
"
,
xml
);
free
(
xml
);
}
until_print_game
=
100
;
until_print_game
=
100
;
}
}
tarot_game_free
(
game
);
tarot_game_free
(
game
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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