aboutsummaryrefslogtreecommitdiff
path: root/analysis/vis.livemd
diff options
context:
space:
mode:
Diffstat (limited to 'analysis/vis.livemd')
-rw-r--r--analysis/vis.livemd23
1 files changed, 13 insertions, 10 deletions
diff --git a/analysis/vis.livemd b/analysis/vis.livemd
index 33e0b54..bd33860 100644
--- a/analysis/vis.livemd
+++ b/analysis/vis.livemd
@@ -17,7 +17,7 @@ require Explorer.DataFrame
require Explorer.Series
alias Explorer.DataFrame, as: DF
alias Explorer.Series, as: SE
-job_id = "1147"
+job_id = "1174"
job_dir = Path.expand(~c"./" ++ job_id) |> Path.absname()
sections_dir = Path.join(job_dir, "sections")
criterion_dir = Path.join(job_dir, "criterion")
@@ -53,15 +53,13 @@ cost_models =
rows
|> Enum.map(fn row ->
- [name, x0, x1, x2, x3, nmrse] = String.split(row, " & ")
+ [row | _] = String.split(row, " \\\\")
+ [name, nmrse | coeffs] = String.split(row, " & ")
[nmrse | _] = String.split(nmrse)
%{
op: name,
- x0: String.to_float(x0),
- x1: String.to_float(x1),
- x2: String.to_float(x2),
- x3: String.to_float(x3),
+ coeffs: coeffs |> Enum.map(&String.to_float/1),
nmrse: String.to_float(nmrse)
}
end)
@@ -84,11 +82,11 @@ cost_models
```elixir
startn = 0
-endn = 200_000
+endn = 80_000
resolution = 100
points_for = fn impl, op ->
- %{"x0" => [x0], "x1" => [x1], "x2" => [x2], "x3" => [x3]} =
+ %{"coeffs" => [coeffs]} =
DF.filter(cost_models, impl == ^impl and op == ^op)
|> DF.to_columns()
@@ -97,7 +95,12 @@ points_for = fn impl, op ->
impl: String.split(impl, "::") |> List.last(),
op: op,
n: n,
- t: x0 + n * x1 + n * n * x2 + n * n * n * x3
+ t:
+ coeffs
+ |> Enum.with_index()
+ |> Enum.map(fn {coeff, idx} -> coeff * n ** idx end)
+ |> Enum.sum()
+ |> max(0)
}
end)
|> DF.new()
@@ -107,7 +110,7 @@ end
<!-- livebook:{"reevaluate_automatically":true} -->
```elixir
-inspect_op = "contains"
+inspect_op = "insert"
cost_models
|> DF.filter(op == ^inspect_op)