https://kedro.org/ logo
#plugins-integrations
Title
# plugins-integrations
y

Yong Bang Xiang

09/01/2023, 9:10 AM
It seems that
kedro-viz
does not recognise
kedro-mlflow
matplotlib plots: while it does appear as a data node in the
kedro-viz
dashboard, the content cannot be examined as a usual matplotlib png.
Copy code
example_plot:
  type: kedro_mlflow.io.artifacts.MlflowArtifactDataSet
  data_set:
    type: matplotlib.MatplotlibWriter
    filepath: data/08_reporting/example_plot.png
    versioned: true
👀 2
n

Nok Lam Chan

09/01/2023, 9:15 AM
@Nero Okwa
n

Nero Okwa

09/01/2023, 9:29 AM
It seems correct as per the docs. Can you remove 'versioned: true' and try it again.
@Yolan Honoré-Rougé any thoughts on this?
d

Deepyaman Datta

09/01/2023, 9:33 AM
@Nero Okwa would you expect support for
MlflowArtifactDataSet
. I've never tried this, but intuitively I wouldn't expect Kedro-Viz to support a dataset using
MatplotlibWriter
under the hood.
n

Nero Okwa

09/01/2023, 9:39 AM
@Deepyaman Datta Yes Kedro Viz supports this, but you need add it to your dependencies first.
@Yong Bang Xiang have you added the dataset to your
src/requirements.txt
file? like this:
Copy code
kedro-datasets[matplotlib.MatplotlibWriter]~=1.1
seaborn~=0.12.1
y

Yong Bang Xiang

09/01/2023, 9:44 AM
yes i have. still no luck.
n

Nero Okwa

09/01/2023, 9:46 AM
Can you share a screenshot of what you are seeing?
y

Yong Bang Xiang

09/01/2023, 9:56 AM
Copy code
example_plot:
  type: matplotlib.MatplotlibWriter
  filepath: data/08_reporting/example_plot.png
Copy code
example_plot:
  type: kedro_mlflow.io.artifacts.MlflowArtifactDataSet
  data_set:
    type: matplotlib.MatplotlibWriter
    filepath: data/08_reporting/example_plot.png
y

Yolan Honoré-Rougé

09/01/2023, 10:09 AM
How does kedro-viz decide what to plot? Does it check for the dataset being a ``MatplotlibWriter`` instance?
n

Nero Okwa

09/01/2023, 10:15 AM
Yes.
y

Yolan Honoré-Rougé

09/01/2023, 10:31 AM
If yes, it explains the issue because kedro-mlflow turns it into a ``MlflowMatplotlibWriter`` object under the hood
n

Nok Lam Chan

09/01/2023, 11:24 AM
Agree with @Deepyaman Datta, I don’t expect kedro-viz work for custom dataset as it is inspecting the type of dataset directly. @Yolan Honoré-Rougé Does ``Mlflow.MatplotlibWriter` exist? I did a quick search and couldn’t find anything related.
I think it is more beneficial to turn this into a discussion how we can have a generic support. Same goes with the
DataFrame
preview feature. Questions: 1. Do we want to add support for individual datasets when requested? 2. Or can we provide a way that allow user to register their own dataset to be displayed?
👍🏽 1
y

Yolan Honoré-Rougé

09/01/2023, 11:28 AM
No, actually MlflowArtifactDataSet is a very special dataset which use ___new___ toninstantiate class and fake inheritance. It modifies object class on the fly.
👀 1
n

Nok Lam Chan

09/01/2023, 11:28 AM
Obviously not everything can be supported, so we need to consider what can be display. For
preview
feature, it is less restricted because we inspect
DataFrame
instead of
pandas.CSVDataSet
, meaning that if user implement their own
pandas.MyDataSet
it will still work as long as it returns a DataFrame.
d

Deepyaman Datta

09/01/2023, 11:53 AM
I think, rather than adding support for individual datasets, it may make sense to create an interface that datasets can implement to have this support, because its a relativrly small set of datasets that would need to support it (I'd assume). That said, this is definitely a topic that would require tech design. :) But @Yong Bang Xiang to close the loop: I would say it's the expected behavior that this doesn't currently work, however unfortunate
👍🏼 1
👍 1
👍🏽 1
j

Juan Luis

09/01/2023, 2:36 PM
I think, rather than adding support for individual datasets, it may make sense to create an interface that datasets can implement to have this support
+100, maybe even checking for
_repr_png_
method, like IPython/Jupyter do
👍 2
3 Views