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
openmole
openmole
Commits
3830eaf5
Commit
3830eaf5
authored
Nov 17, 2021
by
Romain Reuillon
Browse files
[Tool] fix: kl divergence
parent
15a731ca
Pipeline
#1241
passed with stages
in 52 minutes and 34 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
openmole/third-parties/org.openmole.tool.statistics/src/main/scala/org/openmole/tool/statistics/Stat.scala
View file @
3830eaf5
...
...
@@ -208,7 +208,7 @@ trait Stat {
def
klDivergence
(
p1
:
Array
[
Double
],
p2
:
Array
[
Double
])
=
{
val
s
=
(
p1
zip
p2
).
filter
{
case
(
p1
,
p2
)
⇒
p1
=
=
0.0
||
p2
=
=
0.0
}.
filter
{
case
(
p1
,
p2
)
⇒
p1
!
=
0.0
&&
p2
!
=
0.0
}.
map
{
case
(
p1
,
p2
)
⇒
p1
*
math
.
log
(
p1
/
p2
)
}.
sum
s
/
math
.
log
(
2
)
...
...
Write
Preview
Supports
Markdown
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