Professional Documents
Culture Documents
AutomatingTinderwithEigenfaces
crockpotveggies
(/)
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
1/10
2015/2/10
AutomatingTinderwithEigenfaces
Since Tinders rising popularity, including its use by Olympic athletes such as
snowboarder Rebecca Torr, Tinder has achieved critical adoption as a
launchpoint for singles meeting singles. Its rising popularity has encouraged
a wave of "Tinderbot" inventions by nerds doing things such as "swiping
right" for everyone near their location (and of course those pesky
spammers). It wasn't my intention to "one-up" the competition, but using
the facial recognition algorithm Eigenfaces I built a bot that learns when to
swipe right (like a person) AND swipe left (dislike a person) AND start your
conversations.
Dubbed "Tinderbox", the first version only took 3 weeks to build. It uses an
existing Tinder account and taps into Tinder APIs, which is nice so you don't
have to create an entirely new account. Tinderbox recreates the Tinder app
in your browser, including the inbox and discovery preferences. The
workflow is simple:
The built-in bot builds facial models using your likes/dislikes
Bot examines profile images, cropping faces
Faces are loaded into an "average" face representing choices
Eigenfaces are computed from average faces
Bot then makes future selections based on Eigenface comparison
Comparisons are essentially k-nearest neighbor selection
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
2/10
2015/2/10
AutomatingTinderwithEigenfaces
identifiable faces are used (to filter out false positives). Then after each
image is normalized, its pixels are converted into a matrix where they are
then appended to a list of models. The models are then averaged into a
single face used for future comparison (as noted in the workflow above).
The bot requires you to make 60 yes/no choices before it has enough data
to choose on your behalf. Then its on full auto-pilot.
If you're interested in the code behind this, here's a snippet of the two main
defs for computing Eigenfaces:
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
3/10
2015/2/10
AutomatingTinderwithEigenfaces
/**
*ComputestheEigenFacesmatrixusingapixelmatrixofmultipleima
ges.
*@parampixelMatrix
*@parammeanColumn
*/
defcomputeEigenFaces(pixelMatrix:Array[Array[Double]],meanColumn:A
rray[Double]):DoubleMatrix2D={
valdiffMatrix=MatrixHelpers.computeDifferenceMatrixPixels(pixelMa
trix,meanColumn)
valcovarianceMatrix=MatrixHelpers.computeCovarianceMatrix(pixelMa
trix,diffMatrix)
valeigenVectors=MatrixHelpers.computeEigenVectors(covarianceMatri
x)
computeEigenFaces(eigenVectors,diffMatrix)
}
/**
*ComputestheEigenFacesmatrixforadatasetofEigenvectorsanda
diffmatrix.
*@parameigenVectors
*@paramdiffMatrix
*/
defcomputeEigenFaces(eigenVectors:DoubleMatrix2D,diffMatrix:Array[
Array[Double]]):DoubleMatrix2D={
valpixelCount=diffMatrix.length
valimageCount=eigenVectors.columns()
valrank=eigenVectors.rows()
valeigenFaces=Array.ofDim[Double](pixelCount,rank)
(0to(rank1)).foreach{i=>
varsumSquare=0.0
(0to(pixelCount1)).foreach{j=>
(0to(imageCount1)).foreach{k=>
eigenFaces(j)(i)+=diffMatrix(j)(k)*eigenVectors.get(i,k)
}
sumSquare+=eigenFaces(j)(i)*eigenFaces(j)(i)
}
varnorm=Math.sqrt(sumSquare)
(0to(pixelCount1)).foreach{j=>
eigenFaces(j)(i)/=norm
}
}
valeigenFacesMatrix=newDenseDoubleMatrix2D(pixelCount,rank)
eigenFacesMatrix.assign(eigenFaces)
}
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
4/10
2015/2/10
AutomatingTinderwithEigenfaces
/**
*Computesthedistancebetweentwoimages.
*@parampixels1
*@parampixels2
*/
privatedefcomputeImageDistance(pixels1:Array[Double],pixels2:Arra
y[Double]):Double={
vardistance=0.0
valpixelCount=pixels1.length
(0to(pixelCount1)).foreach{i=>
vardiff=pixels1(i)pixels2(i)
distance+=diff*diff
}
Math.sqrt(distance/pixelCount)
}
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
5/10
2015/2/10
AutomatingTinderwithEigenfaces
What are the results so far? The bot is amazingly effective. I would estimate
an accuracy of up to 70% in its selections - though there may be a hindsight
bias. Using a brand new account, I did a quick test to see how quickly the
bot could get results. In 48 hours, the bot registered 21 matches (starting all
of those conversations), made 4 extended conversations, and the bot itself
made over 300 moves. A "move" is any step the bot makes in either sending
a message or making a swipe. And in that time I barely needed to touch the
app. I also created a dashboard to give me an overview of my metrics (see
screenshot below).
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
6/10
2015/2/10
AutomatingTinderwithEigenfaces
What do girls think of the bot? I've gone on at least 10 dates with the help of
the bot and I've shown my partners the bot in its entirety. One date literally
didn't believe me and thought I was pulling her leg. Another person thought
it was really cool and wanted the full tour. All were in agreement that it is
not creepy, though some felt it was borderline. Kind of nice considering it's
not something you'd come across everyday.
Am I still using the bot? I've actually turned it off for now. Admittedly, it
worked too well and started to conflict with work. Although in a couple
cases I had follow-ups and I'm still seeing one person.
Check out the code online: https://github.com/crockpotveggies/tinderbox
(https://github.com/crockpotveggies/tinderbox). Please feel free to
contribute. I don't have current plans to pursue this commercially, though
the license allows personal use and modification.
(/2015/02/09/automating-tinder-with-eigenfaces.html)
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
7/10
2015/2/10
AutomatingTinderwithEigenfaces
(/2014/11/01/public-company-public-humility.html)
(/2014/10/30/amelia-earhart-metal-fragment-2-2-v-1.html)
(/2014/10/30/amelia-earhart-metalfragment-2-2-v-1.html)
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
8/10
2015/2/10
AutomatingTinderwithEigenfaces
(/2014/10/14/centrality-algorithms-betweenness-markov.html)
(/2014/08/25/review-ancient-jung-java.html)
(/2014/07/06/tried-capture-bear-got-deer.html)
(/2014/07/06/tried-capture-bear-gotdeer.html)
In a follow up to my most
CONTACT
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
9/10
2015/2/10
AutomatingTinderwithEigenfaces
(https://twitter.com/crockpotveggies)
(https://github.com/crockpotveggies)
(http://linkedin.com/in/justinlongfellow)
(https://mixpanel.com/f/partner)
http://crockpotveggies.com/2015/02/09/automatingtinderwitheigenfaces.html
10/10