Dvc: plots: support yaml

Created on 8 Jun 2020  路  4Comments  路  Source: iterative/dvc

DVC supports JSON and YAML for metrics, but not for plots.

Details: https://github.com/iterative/dvc.org/pull/1382#discussion_r434967192


UPDATE by Jorge:

  • [ ] Let's remember to update docs when this is figured out 馃檪 Either in iterative/dvc.org/pull/1382 or in it's own PR on top of those changes.
feature request p0-critical

Most helpful comment

@pared so, it this a bug? let's label it appropriately and discuss with @efiop if can fix it this sprint before release.

All 4 comments

@dmpetrov actually we do support yaml, thoguh my tests are very simple, and just uses yaml-encoded list
eg:

-y: 2
-y: 3

The original issue (mentioned by @jorgeorpinel ) is about finding metric inside dictionary. Yaml parsing is already present, mechanism for extracting array of values is used in JSONPlotData class, so this issue should be simply about adding _find_data method to YAMLPlotData, and associated tests.

@pared so, it this a bug? let's label it appropriately and discuss with @efiop if can fix it this sprint before release.

original issue (mentioned by @jorgeorpinel ) is about finding metric inside dictionary

If you just convert the JSON example from https://dvc.org/doc/command-reference/plots/show#example-hierarchical-data-json to YAML and try to use it, it gives the same error.

---
train:
- accuracy: 0.96658
  loss: 0.10757
- accuracy: 0.97641
  loss: 0.07324
- accuracy: 0.87707
  loss: 0.08136
- accuracy: 0.87402
  loss: 0.09026
- accuracy: 0.8795
  loss: 0.0764
- accuracy: 0.88038
  loss: 0.07608
- accuracy: 0.89872
  loss: 0.08455

Save as train.yaml.default

位 dvc run -n yamlplot -d train.yaml.default --plots train.yaml \
          cp train.yaml.default train.yaml
...
位 dvc plots show train.yaml
ERROR: unexpected error - 'str' object has no attribute 'keys'

UPDATE: If you remove the first 2 lines form the YAML file

---
train:

it does generate the plot correctly. Not sure whether this is how it should work, please lmk so we can document YAML support and write some examples.

Was this page helpful?
0 / 5 - 0 ratings