The limits of machine learning. I thought the new "FacialGender" option for Classifier would be an amusing thing to explore.

This is really me.

So far, so good. But that's me with bed-head. So let's try a picture after I'm a bit more cleaned up. Frownie me, boy. Smiley me, girl. Hmmmmmm.


It turns out you can confuse the classifier just by changing your facial expression. (Poking out your tongue is apparently male behaviour, by the way.)

I was interested in knowing if the classifier was picking out the more obvious facial differences between the sexes – the ones we can all subconsciously pick in a fraction of a second – or whether it was being bamboozled by mere gender presentation. So I checked it on photos of Riley J Dennis, a transgender woman with a rather obvious Adam's apple who writes for Everyday Feminism, and Lea DeLaria, a self-described butch lesbian, known for playing Big Boo on Orange Is the New Black. The classifier coded Riley as female and Lea as male. While some might argue the point on the former, the latter is clearly incorrect. (Lest you think I'm making a political statement here, I also tried a photo of Jon Bon Jovi in his 1987 big-hair days – the classifier says female!)

The classifier gets Ellen De Generes right, but is confused by Samira Wiley: the photo on her Wikipedia page gets classified as female, but this picture of her playing Poussey Washington from Orange Is the New Black codes as male. Here is that result along with the one for DeLaria.

No, Lea DeLaria and Samira Wiley are NOT blokes, you heteronormative machine!

At this point it became clear that the classifier has not been appropriately calibrated to detect sex. Since this is a Q&A site, I better phrase this as a question:

Is there a way to improve built-in classifiers, especially this one, with further training and feedback where it gets it wrong?

And when people mistakenly call me "Sir", do I just need to smile?

EDIT Update for version 12.1

Someone's tuned the learning algorithm. It now gets me right – and the newer "FacialAge" classifier gets my age within 12 months!! – but the Jon Bon Jovi photo is still classified as female and the Samira Wiley as Poussey Washington photo is still classified as male.

  • 8
    $\begingroup$ lol -- that is all (p.s. nice to see you around) $\endgroup$
    – Mr.Wizard
    Commented Sep 30, 2017 at 1:36
  • 2
    $\begingroup$ Oh, this is going to be fun at immigration kiosks around the world.... $\endgroup$
    – user21
    Commented Sep 30, 2017 at 1:38
  • 4
    $\begingroup$ The point of 'feedback' to math models is one discussed in Weapons of Math Destruction $\endgroup$
    – user21
    Commented Sep 30, 2017 at 1:41
  • 8
    $\begingroup$ Women smile, men frown. What else do you need to know? $\endgroup$
    – bill s
    Commented Sep 30, 2017 at 1:42
  • 3
    $\begingroup$ We just tried it (on a female face—I have a beard so I can't get it to think I'm a girl), and it's not hard to make the classifier change its mind. It seems to be more sensitive to the hair than the smile. $\endgroup$
    – Szabolcs
    Commented Sep 30, 2017 at 10:36

2 Answers 2


Practically, is there anything you can do? Probably not within reason.

Maybe here's a manageable suggestion: You've suggested in your example,that the classifier is picking up whether the face is smiling or not and this is informing its results (because for some reason one of the gender categories had more smiling in it). In that case you could explicitly try to debias for smiling. But this would really just be creating a classifier for smiling and then essentially penalizing predictions that went along with the bias by an amount proportional to the bias's strength. For example, we'd be interested in:

P(actualCategory = "female" | prediction = "female" && "face" = "smiling")

And we're worried about the fact that there's a bias because this:

P(prediction = "female" | "face" = "smiling")

isn't 50%.

If we can get an estimate for the bias and have a classifier for smiling, then we should just be able to update our result with Bayes' rule.

  • 2
    $\begingroup$ I've also wanted to work thru this paper which is also interesting and related. arxiv.org/pdf/1607.06520.pdf $\endgroup$
    – Searke
    Commented Oct 3, 2017 at 5:13

Is there a way to improve built-in classifiers, especially this one, with further training and feedback where it gets it wrong?

Am I missing something? I didn't expect the answer to be so obvious: https://www.wolfram.com/language/11/external-services/train-a-classifier-function-with-images-from-the-w.html?product=mathematica


Doesn't really answer the question - I don't want to train a new custom classifier. I want to know if we can unbork the built-in ones

I don't think it would be hard (for Wolfram) to implement a hint suggestion system. We can already train ImageIdentify via the "Image Identification Project" web site:


The ability to train and fine tune AI is a good idea. However when it comes to generic things like Facial Expressions (7 billion people times an average of 21 facial expressions) training is going to take a long, long time. You'd need a really smart system to train the AI system... eg something crafty like a Captcha Phone Unlock facial recognition app that feeds the Image Identification Project.

Training specific Buildings/Houses would be far easier, faster and accurate. Mere mortals could do that and its why I recommend putting in a feature request to do the same for Classifier and its various options as we can for ImageIdentify:

enter image description here

An interesting quote from Stephen Wolfram that talks to this topic:

"Like many projects we tackle for the Wolfram Language, developing ImageIdentify required bringing many diverse things together. Large-scale curation of training images. Development of a general ontology of picturable objects, with mapping to standard Wolfram Language constructs. Analysis of the dynamics of neural networks using physics-like methods. Detailed optimization of parallel code. Even some searching in the style of A New Kind of Science for programs in the computational universe. And lots of judgement calls about how to create functionality that would actually be useful in practice."

REF: http://blog.stephenwolfram.com/2015/05/wolfram-language-artificial-intelligence-the-image-identification-project/

Ps Does this question remind anyone else of Silicon Valley S4 E3, where Erlich goes to Uni and gives students assignments to "classify" food types for their Seefood app? Very funny series if you haven't seen it.

  • $\begingroup$ Doesn't really answer the question - I don't want to train a new custom classifier. I want to know if we can unbork the built-in ones. $\endgroup$
    – Verbeia
    Commented Oct 9, 2017 at 4:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.