Posts tagged: 'snippet'
Eager exception logging in Python
Recently I've been spending more time introducing best practise with Python, and particularly I have started logging. I've actually become quite positive about logging and have (several times) found it vital to debugging the errors in my code. I did find in several occasions that there was a particular pattern that was missing in the intersection of logging and exception handling that I've come to think of as 'eager exception logging'. The key difference to this and other exception patterns is that I want to raise and log the exception at the same time.
Visualising confidence in multi-class classification problems
It is best practise to visualise the confidence of predictive models whenever possible. With binary classification in two dimensions this is particularly straightforward since confidence that is lost from one class is necessarily gained by the other. With more classes the visualisation becomes less straightforward: confidence can be lost to any combination of classes and to each at different rates. Voronoi diagrams are a popular way of displaying multi-class predictions, but unfortunately these do not directly show predictive confidence. In this post I briefly describe and give code for a method that embeds multi-class confidence in predictive diagrams.