2

I want to dynamically generate validation error while training the the model. I hate matplotlib :) But I have recently found out about plotly. Now I want to do it using plotly

I have tried to change the figure:

fig.data[0].x = list(range(len(validation_errors)))
fig.data[0].y = validation_errors

or update trace:

fig.update_traces(
    x=[np.arange(len(new_validation_errors))],
    y=[new_validation_errors],
    selector=dict(name='Validation Error')
)

but as I understand if you call fig.show() before and after the update it just draws two plots

Is there any way to update the same plot?

Derek O
  • 16,770
  • 4
  • 24
  • 43
  • +1 for the matplotlib hate. unfortunately, you cannot perform live updates in plotly. however this can be done in `plotly-dash` because `callbacks` are supported. if you are interested in such a solution, i can write something out for you, although it might be helpful if you can provide some background or even just a small toy example of some of your validation errors, and how your model is updating those – Derek O Apr 14 '23 at 19:24
  • 1
    Ooo, that's sad. I have managed to do it through callbacks, but I was interested in more elegant solution I guess. Anyway, thanks) – Захар Наумець Apr 15 '23 at 06:00

0 Answers0