Live data from Hacker News

Using Machine Learning and Node.js to detect the gender of Instagram Users

totems.co

21–30 of 56 posts

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#21
Thanks for sharing your experience! Couple of questions

Why implement the training in NodeJS and not use an existing library in R or Python (scikit-learn) and just implement the scoring (feedforward network) in Node?

Did you just use a single test/train split? What is the variation in Res if you run cross validation?

Your article suggests that you used MI to select the 10k best features. Did you perform this MI feature selection before your test/train split? If so, you would already be "using" your class labels, and the results will be biased. It is likely your true generalisation error will be lower.

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#22
post #21

Thanks for sharing your experience! Couple of questions Why implement the training in NodeJS and not use an existing library in R or Python (scikit-learn) and just implement the scoring (feedforward network) in Node? Did you just use a single test/train split? What is the variation in Res if you run cross validation? Your article suggests that you used MI to select the 10k best features. Did you perform this MI featu…

> Why implement the training in NodeJS and not use an existing library in R or Python (scikit-learn) and just implement the scoring (feedforward network) in Node?

We wanted to contribute to the nodeJS ecosystem and build whatever tool was missing to use neural network directly from NodeJS or at least as an add-on. We also wanted to come up with a simple an straightforward implementation to serve as an educational example rather than just bind into an existing library (even though the results might have been better of course)

> Did you just use a single test/train split? What is the variation in Res if you run cross validation?

We didn't use cross-validation but rather simple train/test split (though our test set was quite large ~100k / 570k). As explained in the intro we wanted to stay very practical and were ok with dirty shortcuts as long as the result looked OK.

> Did you perform this MI feature selection before your test/train split? If so, you would already be "using" your class labels, and the results will be biased. It is likely your true generalisation error will be lower.

Yes MI selection was made on the overall data set before training. You totally are right that this is a bias against the test set. Nice catch.

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#23

This is a great example of how privacy is not optional, even in "opt-in" systems such as Instagram and FB. That Instagram does not require you to have a Facebook profile, and Facebook does not require you to list gender means very little in terms of your own privacy. Merely choosing to withhold information about yourself does not insulate you from a breach of privacy. That others do disclose such information allows 3…

> There's a strange morality here: at what point is it unethical to voluntary disclose data about oneself

That's an interesting question. Especially since the data you disclose may triggers inappropriate inference of characteristics on someone else, maybe eventually causing some form of harm (anytime the demo fails to classify someone, we do cause some harm to him/her in a way). In the case where the misclassification is more harmful than the privacy disclosure, one is better off disclosing the information... weird equilibrium.

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#24
post #14
post #11

Wouldn't Bayesian filter be better suited? There must be a reason Spam Filter use them instead of Neural Networks.

_up we evaluated thoroughly perceptron which are somewhat close to Bayesian networks. Basically a perceptron is a one layer NN and is therefore quite similar to a bayesian network in the fact that it encodes a linear regression. That being said... studying bayesian networks more thoroughly might raise better results indeed. Don't know though if Gmail is using bayesian networks or deep learning?

I don't know about GMail specifically, but I suspect your approach of using neural networks is the best one given the state-of-the-art in machine learning today.

You can think of naive bayes and a perceptron as roughly equivalent in terms of expressiveness--they're both linear models--but a perceptron is usually better since it can account for correlations between input variables.

As you say, a perceptron is a one-layer neural network, so with a large enough training set, a multi-layer neural network will almost certainly perform better since it can recognize combinations of features that work well together.

Bayesian filtering for spam detection is a good starting point since it's easy to implement, and was very popular in the mid-2000s, but with all the advancements in deep learning since 2006, I'd almost certainly bet on a neural network these days.

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#25
post #12

Earlier quoted context omitted.

I deleted it shortly after submitting it, because the demo crashed and we didn't want to waste such a great opportunity on HN on a failed demo. I know it's not perfect... But heh. Hope it's ok.

The "post if WRONG" twitter link failed on my iPhone 5. My instagram name is the same as my HN user id, and you classified me with 99.3% as female... Needs work!

It looks like very few of your photos have captions, meaning that the algorithm doesn't have a lot of text to work with, and among those that do have text there are a few there which contain keywords that are probably heavily waited toward female such as "pink".

The algorithm could probably be improved to also take the instagram name into consideration. Someone named "arthur" is very unlikely to be female.

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#28
post #2

It's unusual to see a coherent, from-first-principles explanation of a neural network. Especially one that's commercially valuable (i presume) to Totems. Mildly alarmed to learn I'm only .039 probability male, though - better bloke it up on Instagram.

What's so alarming about being thought female?

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#29
post #8
post #4

Earlier quoted context omitted.

Hi minimaxir. We have a large number of tokens from our clients and people doing oauth to access our free demo. Since the data is public, we can use any of these tokens to access hashtags and account followers, etc... Actually, Instagram API limit is pretty high when compared to other platform. Today we have something like 100k tokens available to us, which means we can make 12bn+ calls everyday. Almost like having a…

@yid. I'd be curious to understand why you think they would ban us? For using the tokens this way? Well they know everything about our usage of these tokens, and any analytics tool out there behave similarly, right?

> For using the tokens this way? Well they know everything about our usage of these tokens, and any analytics tool out there behave similarly, right?

Yes, for using what are intended as per-user activity tokens for public scraping (which the user who has been issued the token has not requested). As you said, you can assemble a firehose using this method, and if they'd wanted apps to access a firehose, they'd have come up with an API for it.

Re: Using Machine Learning and Node.js to detect the gender of Instagram Users

#30
post #17
post #14

Earlier quoted context omitted.

_up we evaluated thoroughly perceptron which are somewhat close to Bayesian networks. Basically a perceptron is a one layer NN and is therefore quite similar to a bayesian network in the fact that it encodes a linear regression. That being said... studying bayesian networks more thoroughly might raise better results indeed. Don't know though if Gmail is using bayesian networks or deep learning?

My guess is that gmail is using a linear classifier. Both because of the scale of the data, and because up until very recently linear classifiers have been state of the art on text classification. In the few cases where NN have achieved new state of the art on text, the stanford sentiment analysis work and a few more recent works, a full sentence parse is needed. Sentence parses do achieve 95% accuracy, but only on w…

> My guess is that gmail is using a linear classifier.

Yup, the Google "Priority Inbox" feature does indeed use a linear classifier, in particular logistic regression [1] for the reason of scale as you point out.

Also, IIRC Gmail's original spam detection used naive bayes. It may have evolved since then.

[1] http://static.googleusercontent.com/media/research.google.co...

Post reply on HN