neptune-ai / neptune-client

📘 The experiment tracker for foundation model training
https://neptune.ai
Apache License 2.0
587 stars 63 forks source link

Feature Request: Different types of graphs (similar to capabilities of matplotlib) - live tracking #1020

Open Arseni1919 opened 2 years ago

Arseni1919 commented 2 years ago

Hi, my name is Arseni.

I am running different ML experiments and my personal pain: I want to monitor the experiments online during the run of a script. I like your organisation and your tools a lot, that is why I wish I could use your product more. But it seems that you are not goint to incorporate some features an time soon that super important to me and maybe important to others as well.

I would like to plot online not only ONE kind of plots as you offer - lines (!). Only line charts I can plot with you. But I want to be able to plot online MANY types of graphs: 3d plots, plt.imshow style plots, bar plots, scatter plots, pie charts and all those great tools that I see in matplotlib.

For now, the only good alternative is, as I said, Matplotlib with their strange sollution of doing plt.pause(0.01) once in a while to plot things during the run. I hope you understand what I am talking about.

You can say: Arseni, stop! We do offer you to upload different types of gfraphs.. But here is the problem: I want them to update online!! NOT to upload them at times to some supplementary folder. I do want the full functionality as your "log" functionality. To see the same graph changing as aresult of the new information comes in - scatter, 3d and others as "log" online.

That will be the great adsvantage for you.. Still no platform of your compatitors didn't do that. I hope I will able to see that feature soon.

Thank you.

Blaizzy commented 2 years ago

I would like to plot online not only ONE kind of plots as you offer - lines (!). Only line charts I can plot with you. But I want to be able to plot online MANY types of graphs: 3d plots, plt.imshow style plots, bar plots, scatter plots, pie charts and all those great tools that I see in matplotlib.

You can do this using our integrations with the various visualization libraries (i.e., Matplotlib, plotly, bokeh, seaborn, PIL, and so on). Docs:

Yet, as you mentioned, you want them to update online/real-time in the neptune UI. I will pass your feedback on as a feature request to the product team. But before that, would you mind helping me understand the issue better by answering the following:

Arseni1919 commented 2 years ago
  1. Correct - I want to see live changing 3d/scatter/etc. graph as the part of "log" capabilities. I am programming algorithms for robots - with different types of graphs I can plot different statistics, positions (2d and 3d), varianses in signals, orientations, battery persentages - all of it I need to see online.
  2. Why not to visualise locally and the to upload? The answer: a great number of graphs. I cannot simply put all of desired outputs with matplotlib (I need to change layout every single time when the amount of graphs changing - Neptune completely solves this issue for me). Also, the Neptune dashboards are greate! The main idea: I do not want to wait all the way until the end (lets say 100 iterations) in order to understand that I could stop this experiment on the second iteration.
  3. The 3d and scatter are just examples. All of these are good to have: https://matplotlib.org/stable/plot_types/index.html
Blaizzy commented 2 years ago

Got it.

You can do that with Neptune currently by overriding the figure during your loop and to ensure you get to see it before it adds new points to the figure you can use the .wait method.

Below there is a working example that updates the figure as you specified, you can run it and to visualize the changes in the Neptune UI just refresh the page every time you want to check the latest update in case it doesn’t do it automatically.


import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display, clear_output
import neptune.new as neptune

# Create figure and subplot
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1) 

# Init Neptune run
run = neptune.init_run(…)

# Define and update plot
for i in range(100):
    x = np.linspace(0, i, 100);
    y = np.cos(x) 
    ax.set_xlim(0, i)    
    ax.cla()
    ax.plot(x, y)

    # upload figure to Neptune and override it with each new point added 
    run["fig"].upload(fig)

    # wait for all the metadata to reach Neptune servers
    run.wait()

    display(fig)    
    clear_output(wait = True)
    plt.pause(0.1)

run.stop()

Docs:

Check out this website to learn more about creating figures in a loop: https://pythonguides.com/matplotlib-update-plot-in-loop/

Blaizzy commented 2 years ago

Let me know if this works for you

Blaizzy commented 2 years ago

Hey @Arseni1919

Just checking checking to see if you still need help with this issue

Arseni1919 commented 2 years ago

Hi, Blaizzy. The solution that you offered is not good for me for the reasons I mentioned ablove. I still prefer it not in a form of multiple uploaded figures (I knew about this option and it also will take more memory in an autogenerated .neptune folder), but in a form of a graph as I described. I will use regular matplotlib for now until Nuptune will incorporate at list some of other types of graphs inside their system. I still need this new feature. Did you send the request to the team already?... Thank you in advane, Arseni.

Arseni1919 commented 2 years ago

For example, instead of building some bar plot and then uploading it to the neptune, I will upload it straightaway. Maybe it will look like this:

import numpy as np
import neptune.new as neptune

# Init Neptune run
run = neptune.init_run(…)

# Define and update plot
for i in range(100):
    x, y = new_exp_step_output()

    # upload figure to Neptune and override it with each new point added 
    run["results/bar_plot"].bar_log(y)

run.stop()

You can see how much it less code than the previous example.

Blaizzy commented 2 years ago

I can definitely see your point, and I've flagged your comments as a feature request to our Product team and they will take it from there.

Is there anything else I can help you with at the moment? 

Arseni1919 commented 2 years ago

Waiting for the update:) Thank you!

Blaizzy commented 2 years ago

I just spoke to the product team. They mentioned that feature you requested is definitely one we want to add to the product and it is in our backlog but currently there is no ETA on it.

I'll leave this issue open until the feature is released and also so others can see the current workaround.