Skip to content
Snippets Groups Projects
Commit a29b511d authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

include the standard deviation of "inbreeding" measurements (dragoon/komodo!119)

this adds `$.diversity.e` to the output of `inbreeding load` and input of `inbreeding plot` to show errors bars in the final plot.

these can be discarded by running something similar to
```bash
inbreeding load $experiment
    | reject diversity.e
    | inbreeding plot --options { k: $OPTS.k }
```
parent 31d58f4c
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ def get-experiments []: nothing -> list<string> { ...@@ -13,7 +13,7 @@ def get-experiments []: nothing -> list<string> {
export def main [ export def main [
experiment: string@get-experiments, # something of the form '<seed>-<env>' experiment: string@get-experiments, # something of the form '<seed>-<env>'
]: nothing -> table<strategy: string, diversity: table<x: int, y: float>> { ]: nothing -> table<strategy: string, diversity: table<x: int, y: float, e: float>> {
let exp = $experiment | parse "{seed}-{env}" | into record let exp = $experiment | parse "{seed}-{env}" | into record
if $exp == {} { if $exp == {} {
error throw { error throw {
...@@ -46,8 +46,10 @@ export def main [ ...@@ -46,8 +46,10 @@ export def main [
| parse "{x}, {y}" | parse "{x}, {y}"
| into float y | into float y
| group-by x --to-table | group-by x --to-table
| update items { get y | math avg } | insert y { get items.y | math avg }
| rename --column { group: "x", items: "y" } | insert e { get items.y | math stddev }
| rename --column { group: "x" }
| reject items
| into int x # NOTE: $.x needs to be converted to int here because | into int x # NOTE: $.x needs to be converted to int here because
# `group-by --to-table` converts the grouping key to # `group-by --to-table` converts the grouping key to
# string # string
......
...@@ -43,7 +43,7 @@ def get-color []: int -> string { ...@@ -43,7 +43,7 @@ def get-color []: int -> string {
export def main [ export def main [
--save: path, --save: path,
--options: record<k: int> --options: record<k: int>
]: table<strategy: string, diversity: table<x: int, y: float>> -> nothing { ]: table<strategy: string, diversity: table<x: int, y: float, e: float>> -> nothing {
let data = $in let data = $in
let l = $data.diversity.0 | length let l = $data.diversity.0 | length
...@@ -71,10 +71,6 @@ export def main [ ...@@ -71,10 +71,6 @@ export def main [
"double" => $"($it.strategy.p)? ($it.strategy.n) ; ($it.strategy.m)" "double" => $"($it.strategy.p)? ($it.strategy.n) ; ($it.strategy.m)"
} }
} }
| update diversity {|it|
let l = $it.diversity | length
$it.diversity | insert e 0 | rename --column { t: "x", diversity: "y" }
}
| rename --column { diversity: "points" } | rename --column { diversity: "points" }
| insert style {|it| | insert style {|it|
let color = match $it.strategy.type { let color = match $it.strategy.type {
......
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