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

log_plot: allow for y to be a list #549

Closed
dberenbaum opened this issue Apr 27, 2023 · 10 comments · Fixed by #837
Closed

log_plot: allow for y to be a list #549

dberenbaum opened this issue Apr 27, 2023 · 10 comments · Fixed by #837

Comments

@dberenbaum
Copy link
Collaborator

Should we allow for y to be a list?

Edit: can be a follow up, so not blocking, but I think it makes it significantly more useful.

Originally posted by @dberenbaum in #543 (comment)

@dberenbaum dberenbaum added p3-nice-to-have A: log_plot Area: `live.log_plot` labels Apr 27, 2023
@dberenbaum dberenbaum closed this as not planned Won't fix, can't repro, duplicate, stale Apr 24, 2024
@jenfredwell
Copy link

+1 for this. I came here looking for a way to log a plot with a definition like

- data.json:
    template: linear
    x: c
    y:
    - a
    - b

Is this possible to write directly to data.json instead of live.log_plot(..) and have this definition in the dvc.yaml file?

@dberenbaum
Copy link
Collaborator Author

Is this possible to write directly to data.json instead of live.log_plot(..) and have this definition in the dvc.yaml file?

Yes. You can always manually write to json and configure dvc.yaml yourself. See https://dvc.org/doc/user-guide/experiment-management/visualizing-plots for a guide on how to do it.

@jenfredwell
Copy link

Thanks. I was able to add a plot like this to the dvc.yaml, but it doesn't seem to appear in DVC Studio until a git commit is performed. I was hoping it would be updated live. Is this expected behavior?

@dberenbaum
Copy link
Collaborator Author

Yes, live updates are limited to dvclive plots. You should be able to still see the manual plots once the experiment completes if you run dvc exp push. Would that be enough, or is it important to have the plots updating in realtime?

@dberenbaum dberenbaum reopened this Jul 29, 2024
@jenfredwell
Copy link

I see. Thanks for the clarification. I think that should be fine, but would be nice to get live updates. It's just not what I expected.

@dberenbaum
Copy link
Collaborator Author

@jenfredwell Have you actually tried it? I think it will work even though it's not documented. See this example:

import pandas as pd
from dvclive import Live
from sklearn.datasets import load_iris

iris = load_iris()
datapoints = pd.DataFrame(data=iris.data, columns=iris.feature_names)

with Live() as live:
    live.log_plot(
        "sepal",
        datapoints,
        x="sepal length (cm)",
        y=["sepal width (cm)", "petal width (cm)"],
        template="scatter",
        title="Sepal length vs Sepal/petal width"
    )

This renders a plot like:

visualization(20)

If you confirm it works for you, we can mention support in the docs as well.

@jenfredwell
Copy link

jenfredwell commented Aug 1, 2024

Yes, this actually does work but doesn't seem to update in real time. It looks like the plots/custom directory doesn't get created until the experiment is over.

@dberenbaum
Copy link
Collaborator Author

Sorry @jenfredwell, I had forgotten that Studio does not support live updates of log_plot() results at the moment.

@jenfredwell
Copy link

Ok good to know. Is this in the roadmap by chance? It would be helpful to us to consolidate some of what we're starting to track with dvclive.

@dberenbaum
Copy link
Collaborator Author

Sorry, it's not in the roadmap at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants