exp show --html: Handle fill_value.

Adds new argument `fill_value` to ParallelCoordinatesRenderer.

For scalar columns, prevent converting to categorical by explictly inserting None when value is missing (value == fill_value).

For categorical columns, replace `fill_value` with `"Missing"` and ensure it is the last item so it gets rendered on top of the column.
This commit is contained in:
David de la Iglesia Castro
2021-12-17 14:45:12 +09:00
committed by Peter Rowlands (변기호)
parent 5ee82d4000
commit 4d5be46ab4
6 changed files with 65 additions and 21 deletions
+7 -4
View File
@@ -636,9 +636,7 @@ def test_show_parallel_coordinates(tmp_dir, dvc, scm, mocker):
assert main(["exp", "show", "--html"]) == 0
kwargs = show_experiments.call_args[1]
assert kwargs["color_by"] == "Experiment"
html_text = (tmp_dir / "dvc_plots" / "index.html").read_text()
assert all(rev in html_text for rev in ["workspace", "master", "[exp-"])
assert (
@@ -651,11 +649,10 @@ def test_show_parallel_coordinates(tmp_dir, dvc, scm, mocker):
assert '"label": "metrics.yaml:bar"' not in html_text
assert (
main(["exp", "show", "--html", "--color-by", "metrics.yaml:foo"]) == 0
main(["exp", "show", "--html", "--sort-by", "metrics.yaml:foo"]) == 0
)
kwargs = show_experiments.call_args[1]
assert kwargs["color_by"] == "metrics.yaml:foo"
html_text = (tmp_dir / "dvc_plots" / "index.html").read_text()
assert '"line": {"color": [2.0, 1.0, 2.0]' in html_text
@@ -668,3 +665,9 @@ def test_show_parallel_coordinates(tmp_dir, dvc, scm, mocker):
assert main(["exp", "show", "--html", "--open"]) == 0
webbroser_open.assert_called()
params_data = {"foo": 1, "bar": 1, "foobar": 2}
(tmp_dir / params_file).dump(params_data)
assert main(["exp", "show", "--html"]) == 0
html_text = (tmp_dir / "dvc_plots" / "index.html").read_text()
assert '{"label": "foobar", "values": [2.0, null, null]}' in html_text