arviz-devs / arviz

Exploratory analysis of Bayesian models with Python
https://python.arviz.org
Apache License 2.0
1.61k stars 407 forks source link

Bokeh ColumnDataSource from user input #951

Open ahartikainen opened 4 years ago

ahartikainen commented 4 years ago

To enable linked brushing, we need an option for a user to input ColumnDataSource object which contains the needed data. This will also enable to combine different plot types.

We need to be explicit what different kinds of ColumnDataSources we need. At least we have

Ideally we would like to have some default fields for good hover tooltip. (Like information for draw, chain, variable name(?); dims + coords)

https://docs.bokeh.org/en/1.4.0/docs/reference/models/sources.html

https://docs.bokeh.org/en/1.4.0/docs/user_guide/data.html

amukh18 commented 4 years ago

I would like to work on this issue

amukh18 commented 4 years ago

@ahartikainen Could you please give me a very brief overview of how the implementation of user input should work?

amukh18 commented 4 years ago

So the output should be an InferenceData object which we pass to the plotting functions ?

ahartikainen commented 4 years ago

I will need to show you one example. I think I have that function somewhere (inferencedata to cds)

amukh18 commented 4 years ago

This one ?:https://github.com/arviz-devs/arviz/pull/981 I am currently going through this

ahartikainen commented 4 years ago

Yes, that one.

I think we could see if that could be used (or is it already used) in the bokeh plotting function.

If it is already used, we could add a possibility include cds in some dictionary/argument (probably in backend_kwargs) and if present, use it instead of CDS created in the function.

Let's think how to handle density-based plots later.

amukh18 commented 4 years ago

I am a little confused. I was looking at the bokeh backend file for plot_trace and I think there are already some lines of code that convert the InferenceData object to ColumnDataSource in that file itself.

ahartikainen commented 4 years ago

Yeah, this is probably much more involved thing that it seems at first, I think I will maybe implement this.

amukh18 commented 4 years ago

@ahartikainen Okay

amukh18 commented 4 years ago

@ahartikainen Or Is there any way I could implement at least part of this? I think it would help me learn about Arviz's backend system better

ahartikainen commented 4 years ago

Yes, we can implement this together. Let me give you instructions where we start in a few hours

amukh18 commented 4 years ago

Thank you! I look forward to working on this issue

ahartikainen commented 4 years ago

Ok, I did some inspection for our plotting code, and it is certainly not ready for this feature.

I think we really need to do some serious rewriting to enable this.

I think it is better to focus on other issues for now.

cc @OriolAbril

amukh18 commented 4 years ago

I understand. I will continue my work on the other issues.