Interactive confusion matrix in bokeh

I’d like to plot an interactive confusion matrix in bokeh, since i’m new to python i’m having difficulties with writing the code.

The idea is to have a slider for the threshold (from 0 to 1) and given a vector of real binary outcomes (1,0,0,0,1,1...) and a vector predicted probabilities (0.23,0.54,0.78,0.63,0.1,0.92...) the plot should represent a 2X2 confusion matrix.

Hi there.
Maybe a plot with categorical axis like this one could be something for you?
See also this SO post for another example.

Having a plot responding to slider position (without involving bokeh-server interaction) requires a callback function that you could realise with javascript or with python.

Another option is to create a bokeh-server app where the “slider.on_change” event can trigger execution of an arbitrary Python code on the server to modify the plot data and send it back to the page to be displayed.

You can read more about handling categorical plots here.

Hope it helps

···

On Thursday, February 21, 2019 at 3:56:22 PM UTC+1, Uriah Finkel wrote:

I’d like to plot an interactive confusion matrix in bokeh, since i’m new to python i’m having difficulties with writing the code.

The idea is to have a slider for the threshold (from 0 to 1) and given a vector of real binary outcomes (1,0,0,0,1,1...) and a vector predicted probabilities (0.23,0.54,0.78,0.63,0.1,0.92...) the plot should represent a 2X2 confusion matrix.