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

add information about experiment to `inbreeding load` (dragoon/komodo!134)

this can be used by `plot` without passing extra arguments, i.e. the pipeline becomes
```bash
use bins/inbreeding

let experiment = "..."
```
```bash
inbreeding load $experiment | inbreeding plot
```
instead of having to know the value of `k` and do
```bash
inbreeding load $experiment | inbreeding plot --options { k: $k }
```
parent a3a5f2e2
No related branches found
No related tags found
No related merge requests found
......@@ -37,5 +37,5 @@ inbreeding run --options $OPTS --prng-seed $PRNG_SEED
```
```bash
let experiment = $"($PRNG_SEED)-($OPTS.environment)-($OPTS.k)-($OPTS.n)-($OPTS.nb_bytes)"
inbreeding load $experiment | inbreeding plot --options { k: $OPTS.k }
inbreeding load $experiment | inbreeding plot
```
......@@ -18,8 +18,18 @@ def get-experiments []: nothing -> list<string> {
export def main [
experiment: string@get-experiments,
]: nothing -> table<strategy: string, diversity: table<x: int, y: float, e: float>> {
let exp = $experiment | parse --regex $consts.ARG_EXPERIMENT_FORMAT | into record
]: [
nothing -> record<
experiment: record<k: int, n: int, nb_bytes: int, env: string>,
measurements: table<strategy: string, diversity: table<x: int, y: float, e: float>>,
>
] {
let exp = $experiment
| parse --regex $consts.ARG_EXPERIMENT_FORMAT
| into record
| into int k
| into int n
| into int nb_bytes
if $exp == {} {
error throw {
err: "invalid experiment",
......@@ -45,7 +55,7 @@ export def main [
}
}
$experiment_files
let measurements = $experiment_files
| select name
| insert . { get name | remove-cache-prefix | parse --regex $consts.EXPERIMENT_FORMAT }
| flatten --all
......@@ -71,4 +81,14 @@ export def main [
$d | skip 1 | reduce --fold $d.0 {|it, acc| $acc | append $it}
}
| rename --column { group: "strategy", items: "diversity" }
{
experiment: {
env: $exp.env,
k: $exp.k,
n: $exp.n,
nb_bytes: $exp.nb_bytes,
},
measurements: $measurements,
}
}
......@@ -40,14 +40,16 @@ def get-color []: int -> string {
}
}
export def main [
--save: path,
--options: record<k: int>
]: table<strategy: string, diversity: table<x: int, y: float, e: float>> -> nothing {
let data = $in
let l = $data.diversity.0 | length
export def main [ --save: path ]: [
record<
experiment: record<k: int, n: int, nb_bytes: int, env: string>,
measurements: table<strategy: string, diversity: table<x: int, y: float, e: float>>,
> -> nothing
] {
let experiment = $in
let l = $experiment.measurements.diversity.0 | length
$data
$experiment.measurements
| update strategy { parse strategy }
| insert sort {|it|
match $it.strategy.type {
......@@ -61,10 +63,10 @@ export def main [
| insert name {|it|
match $it.strategy.type {
"single" => {
let sigma = if $it.strategy.n == $options.k {
let sigma = if $it.strategy.n == $experiment.experiment.k {
"k"
} else {
$"k - ($options.k - $it.strategy.n)"
$"k - ($experiment.experiment.k - $it.strategy.n)"
}
$"$\\sigma = ($sigma) = ($it.strategy.n)$"
}
......
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