What I learned today: you can't use if-conditionals in a Keras custom loss function. I managed to come with a solution...
All the operations in the custom loss function need to be vectorised, so an if-conditional breaks it and throws an exception. The solution is to create Boolean vectors corresponding to each condition, turn their types into float (must be float), multiply each Boolean by the corresponding loss function and sum.
Example:
A reference to a discussion and debunking of Rees-Mogg's claims, for those who are not familiar with that particular grubby episode (which, for the avoidance of doubt, I am not suggesting was the actions of Nazis, but rather another example of an attempt to whitewash history by minimising atrocities):
http://gladstonediaries.blogspot.com/2019/02/british-concentration-camps-response-to.html
This is a fascinating and illuminating read, with implications well beyond Wikipedia – think of all the careful narrative framing and dubious claims that you see on social media and hear from politicians – even supposedly mainstream politicians, such as Jacob Rees-Mogg, who attempted to minimise the British use of concentration camps during the Boer War by falsely claiming that the death rate in those camps was the same as the death rate in Glasgow at the time.
If you need to be delighted by something this morning, I present the tree goats of Morocco.
I was driving near Essaouira the first time I saw this and literally slammed on my brakes because I thought I was suddenly hallucinating. But then you learn how common it is and after a day or two it's, oh, yeah, more goats in trees.
Academics! Science people! 🎓 👩🔬 👨🔬
There are some curated lists of academics and scientists to follow on Mastodon here:
➡️ https://github.com/nathanlesage/academics-on-mastodon
(Originally shared by @kcarruthers but reposted so that I can pin the link on my account)
(Just to be clear, I did not write this list, I am just passing on the link!)