Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cml-with-dvc example. #172

Open
daavoo opened this issue Dec 20, 2021 · 3 comments
Open

Update cml-with-dvc example. #172

daavoo opened this issue Dec 20, 2021 · 3 comments
Labels
blocked Dependent on something else documentation Markdown files

Comments

@daavoo
Copy link
Contributor

daavoo commented Dec 20, 2021

Note that this hasn't been released yet but it's merged on master:


For the vega example in https://cml.dev/doc/cml-with-dvc using vl2png, how can this be handled with --json?

Some json manipulation is needed for that. In this particular example:

dvc plots diff \
            --target classes.csv \
            --template confusion \
            -x actual \
            -y predicted \
            --json master | jq '."classes.csv" | .[0]' >> vega.json

I think send-comment with vega plot is a widely used example

Originally posted by @daavoo in iterative/dvc#7093 (comment)

@daavoo daavoo added the documentation Markdown files label Dec 20, 2021
@casperdcl
Copy link
Contributor

What's the advantage of --json | jq <filter> > vega.json over --show-vega > vega.json when we still need to use vl2png anyway?

If we could do something like --json | python -c 'import matplotlib.pyplot as plt, sys; plt.plot(eval(sys.stdin.read())["classes.csv"][0])' instead that would be nice

@daavoo
Copy link
Contributor Author

daavoo commented Dec 30, 2021

What's the advantage of --json | jq <filter> > vega.json over --show-vega > vega.json when we still need to use vl2png anyway?

We can use --show-vega for this example, as long as the flag is not removed 😅.

One difference is that --show-vega only works for a single plot whereas --json can return the list of all plots for a rev. So, jq could be used to do a for loop calling vl2png and cml send-comment. It would be handy for dvclive plots.

Another thing is that --show-vega doesn't return image plots. --json could be used to combine image plots and cml publish.

If we could do something like --json | python -c 'import matplotlib.pyplot as plt, sys; plt.plot(eval(sys.stdin.read())["classes.csv"][0])' instead that would be nice

What would be the advantage over jq?

@casperdcl
Copy link
Contributor

casperdcl commented Jan 3, 2022

What would be the advantage over jq?

You mean "what would be the advantage of --json | python -c '...' over --json | jq <filter> > vega.json && vl2png ...?"

No reliance on vl2png nor jq.

@casperdcl casperdcl mentioned this issue Jan 6, 2022
4 tasks
@casperdcl casperdcl added the blocked Dependent on something else label Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Dependent on something else documentation Markdown files
Projects
None yet
Development

No branches or pull requests

2 participants