All posts by grace

Word2vec: fish + music = bass

Everyone seems to overlook how FUNNY word2vec is! GPT-2 has gotten lots of playful attention, but word2vec never had its day in the sun. Everyone mentions the example “king – man + woman = queen”, but no one mentions the delightful “yeti – snow + economics = homo economicus”.

We know word2vec is rather good at certain kinds of analogies:

Now let’s venture beyond these solid, stolid examples. We can use it on things that don’t have as clear-cut answers as do country capitals or past tenses. We can use it on cloudier concepts, and the results we get are occasionally surprising and appealing!

For those unfamiliar with the conventions of written analogy , “man : woman :: king : queen” is read as “man is to woman as king is to queen.” The relationship between the concepts “man” and “woman” is the same as the relationship between “king” and “queen”.

The examples below always show the top result unless otherwise specified. Occasionally the second or third result is better, and this is indicated with “[2]” or “[3]” after the example. Word2vec’s answers in this post are always written as the last word/phrase on the line.

If you’d like to play along, it’s really easy! First get gensim. Then get
the Google News corpus pre-trained model (3 million 300-dimension word vectors).

(Yes, the model has 3 million words and phrases, which is large enough to include really odd stuff like “World Sexiest Vegetarian” and “Joan Rens nodded”)

Python Code:

import gensim
model = gensim.models.KeyedVectors.load_word2vec_format('GoogleNews-vectors-negative300.bin', binary=True)

# "King - man + woman" looks like:
model.most_similar_cosmul(positive=['king', 'woman'], negative=['man'])

Now, to the fuzzy, funny side of word2vec!

The cow goes moo, the raven goes nevermore

pig : oink :: dog : barks
pig : oink :: cat : miaowing
pig : oink :: cow : moos
pig : oink :: mouse : keypress
pig : oink :: sheep : Baa baa black
pig : oink :: frog : ribbit
pig : oink :: lion : roar
pig : oink :: donkey : clip clopping
pig : oink :: snake : slithering
pig : oink :: rooster : cock doodle doo
pig : oink :: parrot : Squawkers McCaw
pig : oink :: pigeon : chirp chirp
pig : oink :: owl : chitter
pig : oink :: crow : crowing
pig : oink :: raven : nevermore
pig : oink :: roadrunner : beep beep
pig : oink :: penguin : ribbit

pig : oink :: mouth : mumble
pig : oink :: hands : clap
pig : oink :: fingers : strum
pig : oink :: clock : Tick tock
pig : oink :: human : expressible
pig : oink :: baby : bub
pig : oink :: mummy : ah ah ah ah
pig : oink :: corpse : laugh maniacally
pig : oink :: pirate : me hearties
pig : oink :: volcano : spews ash
pig : oink :: car : upshifting
pig : oink :: truck : tires squeal
pig : oink :: motorcycle : popping wheelies

pig : oink :: she : Hi sweetie
pig : oink :: he : Duly noted
pig : oink :: sis : da da
pig : oink :: bro : wassup

pig : oink :: music : sonic bliss
pig : oink :: literature : orality
pig : oink :: film : narration
pig : oink :: drawing : appreciative oohs

pig : oink :: Rice Krispies : Snap crackle pop
pig : oink :: Santa : HO HO HO
pig : oink :: Woody Woodpecker : Yabba dabba doo
pig : oink :: Fred Flinstone : wassup
pig : oink :: Elmer Fudd : haw haw
pig : oink :: Homer Simpson : D’oh
pig : oink :: Donald Trump : YOU’RE FIRED
pig : oink :: Einstein : E = mc2

Wordplay

You can also sometimes get interesting results simply adding or subtracting two words!

fish + music = bass
fish + friend = chum
fish + hair = mullet
fish + struggle = flounder
fish + sunlight = rays
fish + holy = mackeral
fish + education = Matt Krupnick covers (A nonsense answer. I thought it might give “school”)
fish + underwear = crabs (I thought it might give “cod” (as in “cod piece”), but “crabs” is a better answer!)
fish + man = fisherman

Monsters

snow : yeti :: woods : bigfoot
snow : yeti :: air : pterodactyl
snow : yeti :: water : Gharial
snow : yeti :: fire : inferno
snow : yeti :: swamp : nocturnal primate
snow : yeti :: stone : homo floresiensis
snow : yeti :: fog : hantu
snow : yeti :: metal : clawed mutant

snow : yeti :: utopia : chimera
snow : yeti :: dystopia : doppelgänger (posthuman [2])
snow : yeti :: time : Doctor Whos
snow : yeti :: belly : alien creature
snow : yeti :: Mars : astrobiologists
snow : yeti :: Venus : Venusian
snow : yeti :: Mercury : Winged Messenger
snow : yeti :: Mordor : Ringwraiths
snow : yeti :: McDonalds : Hamburglar

snow : yeti :: psychology : primatology
snow : yeti :: physics : quantum mechanics
snow : yeti :: economics : homo economicus
snow : yeti :: college : freeter
snow : yeti :: qualia : mimesis
snow : yeti :: darkness : Conradian (Cardassian [2])
snow : yeti :: lightness : sylph

Jellyfish, the rumble strips of the sea

road : ocean :: car : sailboat
road : ocean :: truck : vessel
road : ocean :: bus : cruise ship
road : ocean :: bicycle : surfboard
road : ocean :: SUV : reef shark
road : ocean :: subway : Staten Island Ferry
road : ocean :: limousine : stateroom
road : ocean :: carriage : square rigged barque
road : ocean :: army : navy
road : ocean :: police : Coast Guard
road : ocean :: guns : harpoons
road : ocean :: mechanic : deckhand
road : ocean :: pedestrian : cetacean [2]
road : ocean :: seatbelt : buoyancy vest
road : ocean :: airbag : rebreathers [2]
road : ocean :: Onstar : LifeTag
road : ocean :: window : porthole
road : ocean :: accident : Cosco Busan spill
road : ocean :: exit : briny depths
road : ocean :: highway : oceans
road : ocean :: railing : transom
road : ocean :: rumble strips : jellyfish
road : ocean :: luggage : snorkel gear
road : ocean :: trunk : gelatinous substance
road : ocean :: radar : sonars
road : ocean :: death : drowning
road : ocean :: snow : glacial meltwater
road : ocean :: wind : sea breeze
road : ocean :: rain : upwellings
road : ocean :: storm : storms
road : ocean :: hamburger : raw ahi
road : ocean :: banana : sea cucumber
road : ocean :: potato chip : kelp
road : ocean :: water : seawater
road : ocean :: lion : Beluga whales
road : ocean :: tiger : shark
road : ocean :: bear : whale

Tools

pencil : sketching :: pen : penning
pencil : sketching :: chalk : chalking
pencil : sketching :: chisel : carving
pencil : sketching :: mallet : sculpting
pencil : sketching :: hacksaw : modifying peepholes
pencil : sketching :: keys : unlocking
pencil : sketching :: rake : raking
pencil : sketching :: hoe : digging
pencil : sketching :: oven : cooking
pencil : sketching :: whiteboard : brainstorming
pencil : sketching :: breadboard : designing
pencil : sketching :: phrase : coining
pencil : sketching :: Twitter : tweeting
pencil : sketching :: Facebook : social networking

pencil : sketching :: mouth : spreading
pencil : sketching :: hands : embracing
pencil : sketching :: fingers : mimicking
pencil : sketching :: ears : listening
pencil : sketching :: muscle : faceoff flexing
pencil : sketching :: butt : strutting
pencil : sketching :: toes : hopping
pencil : sketching :: belly : baring
pencil : sketching :: arms : armaments
pencil : sketching :: forearms : draping
pencil : sketching :: shoulder : dislocating
pencil : sketching :: kneecap : landing awkwardly

pencil : sketching :: human : interrelating
pencil : sketching :: beliefs : espousing
pencil : sketching :: quality : showcasing
pencil : sketching :: thoughts : discussing
pencil : sketching :: reflections : recapitulating
pencil : sketching :: visions : envisioning
pencil : sketching :: wisdom : waxing eloquently
pencil : sketching :: sentience : domesticating
pencil : sketching :: existence : inhabiting
pencil : sketching :: entropy : coalescence
pencil : sketching :: suffering : recovering
pencil : sketching :: immortality : apotheosis

Manly AND Absorbent

woman : man :: purse : wallet
woman : man :: handbag : satchel
woman : man :: romance : bromance
woman : man :: boobs : moobs
woman : man :: prenatal vitamins : creatine
woman : man :: prenatal massage : reiki massage
woman : man :: pregnant : vasectomy reversed [2]
woman : man :: estrogen : testosterone
woman : man :: skinny jeans : baggy jeans
woman : man :: tiara : plumed hat
woman : man :: makeup : facial hair
woman : man :: sexy : badass
woman : man :: 5ft 5in tall : 6ft 2in tall
woman : man :: flute : trombone
woman : man :: tampon : shamwow [2]

Good and Bad

good : bad :: life : humdrum existence
good : bad :: water : sewage
good : bad :: fire : Faulty electrical wiring
good : bad :: air : rancid stench
good : bad :: earth : planet
good : bad :: glass : slashing Leonardo DiCaprio
good : bad :: glow : blinding glare
good : bad :: rock : nü metal
good : bad :: ice : towering snowdrifts
good : bad :: dirt : poisonous weeds
good : bad :: wood : rot termites [2]
good : bad :: anvil : guillotine blade
good : bad :: bone : disfiguring scars
good : bad :: Heaven : Hell
good : bad :: afterlife : netherworld
good : bad :: dolphin : orca
good : bad :: dog : pit bull
good : bad :: deer : elk
good : bad :: human : nonhumans
good : bad :: nanobots : gray goo
good : bad :: love : hate
good : bad :: light : dark
good : bad :: bless : blaspheme
good : bad :: truth : falsehood
good : bad :: alive : dead
good : bad :: awake : sleep deprived
good : bad :: young : teenage
good : bad :: living : squalor
good : bad :: philosophy : ideology
good : bad :: qualia : derangements
good : bad :: epistemology : reductionism
good : bad :: beliefs : prejudices
good : bad :: visions : daydreams
good : bad :: souls : wretches
good : bad :: immortality : infamy (undeath [2])
good : bad :: hedonism : debauchery
good : bad :: humanistic ideals : Orwellian Newspeak
good : bad :: Gandalf : Saruman
good : bad :: fair : unfair
good : bad :: compassionate : heartless
good : bad :: encouraging : discouraging
good : bad :: trusting : mistrusting
good : bad :: fearless : brash
good : bad :: exuberant : delirious
good : bad :: charm : garishness
good : bad :: charmingly self deprecating : pretentious twaddle

Nicer Cursewords

bad : good :: hell : heck
bad : good :: goddamn : damn
bad : good :: damn : darn
bad : good :: shit : sh*t
bad : good :: shite : bollocks
bad : good :: ass : butt
bad : good :: asshole : idiot
bad : good :: arsehole : bloke
bad : good :: ass kisser : thoughtful considerate
bad : good :: bitch : sweetest nicest
bad : good :: bitches : girlies
bad : good :: bitching : whining
bad : good :: bitchin : awesome
bad : good :: fuck : fucking
bad : good :: fuckers : fellers
bad : good :: chrissake : Golly gee
bad : good :: god sake : heaven sake
bad : good :: heaven sake : goodness sake
bad : good :: nooo : ohhhhh

gospel – God = jazz

Bible – God = Casebriefs
Christmas – God = holiday
Sunday – God = Thursday
God bless – God = bid farewell
disciple – God = protégé
messiah – God = wonderboy
crucifix – God = candlestick holder
life – God = career
death – God = disappearance
afterlife – God = ephemera
eternity – God = interminable
church – God = Masonic lodge
theology – God = anthropology sociology
prophecy – God = predictions
doctrine – God = policy
missionary – God = Peace Corps volunteer
belief – God = assumption
believer – God = proponent
virgin birth – God = parthenogenesis [3]
mantra – God = buzzword
religion – God = ethnicity
pious – God = Always impeccably dressed
godly – God = upstanding
reverent – God = staid
heaven – God = nirvana
hell – God = blueing
purgatory – God = limbo (twilight zone [2])
prayer – God = informal chats
spirit – God = enthusiasm
miracle – God = feat
gospel – God = jazz
angels – God = venture capitalists
devils – God = footed boobies
unicorn – God = pony

Suburbia

rainforest : malaria :: suburbia : affluenza
desert : sand :: suburbia : driveways
desert : quicksand :: suburbia : neurosis
desert : sandstorm :: suburbia : suburbanization (traffic snarls [2], Human Stain [3])
forest : owl :: suburbia : suburbanite (yuppie [2])
forest : deforestation :: suburbia : gentrification
ocean : shark :: suburbia : serial slasher

Let’s Just Try Something Random

fruit : music :: apple : classical music
fruit : music :: blueberry : bluegrass
fruit : music :: strawberry : jazz
fruit : music :: banana : Lemvo
fruit : music :: orange : Bruce Springstein
fruit : music :: dragonfruit : hip hop reggaeton
fruit : music :: kiwi : Steriogram (a punk band from New Zealand )
fruit : music :: coconut : Praveen Mani (a film composer from India)
fruit : music :: watermelon : Daryle Singletary (country musician)
fruit : music :: olive : accordionist
fruit : music :: cranberry : polka
fruit : music :: date : unplugged acoustic

Not Analogies, but Still Funny

hospital – doctors = Adult Detention Center
college – professors = tween demos
college – students = redraft leagues
dorm – students = bachelor pad
Space Station – astronauts = SatBroadcasting
chorus – singers = howls
American Idol – singers = Project Runway
casino – gamblers = Wal Mart Supercenter
restaurant – chefs = convenience store
gym – athletes = Quiznos sandwich shop
locker room – athletes = dressing room
library – readers = hall
books – readers = compact discs
courtroom – attorneys = gladiatorial arena
farmland – farmers = parkland
barn – cows = garage
videogames – gamers = cocaine binges
arcade – gamers = ice cream parlor
tavern – drinkers = luncheonette
vineyard – drinkers = orchard
elevator – riders = upstairs
elevator – people = freight elevator
bowling alley – bowlers = Hooter restaurant
UFO – aliens = Airshow
airplane – passengers = Rube Goldberg machine
pep rally – cheerleaders = keynote speech
mall – stores = parking garage
labyrinth – minotaur = confusing maze
spa – massage = indoor waterpark resort
paintball – paint = Airsoft
heroin – addiction = Ecstasy pills
Netflix – internet = Redbox
Twitter – soul = Facebook
music – soul = downloadable ringtones
literature – soul = deviant perverts
self referential – self = absurdist

Word2vec obviously isn’t perfect, and no where near as good at analogies as a humans are. And keep in mind selection effects – I’m showing you examples where word2vec outputs intelligible/interesting answers. Even so, it is super impressive and fun! Give it a try!

Bash Aliases for Harry Potter Enthusiasts!

[Cross-posted as a Gist.]

alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv

alias sonorus=’set -v’
alias quietus=’set +v’

alias colloportus=’openssl enc -aes-256-cbc’ # locking spell! $colloportus -in unencryptedName -out encryptedName
alias alohamora=’openssl enc -d -aes-256-cbc’ # unlocking spell! $alohamora -in encryptedName -out unencryptedName

Continue reading Bash Aliases for Harry Potter Enthusiasts!

Eigenstyle

[Cross-posted at The Hackerati.]

Principal Component Analysis and Fashion

Any set of images can be broken down with Principal Component Analysis. This has been done pretty successfully with faces. Here we’ll take a look at style.

Our dataset is 807 pictures of dresses from Amazon. They have a standard image size, but unfortunately do not have a standard model pose (though they tend to be centered in the image similarly). Ideally, our principal components would only be about actual dress style, but here many of them will be concerned with model pose. Despite this, we can still do a lot with this data set.

imageimage

Continue reading Eigenstyle

Deepdreaming Without the Slugdogs

[Cross-posted at The Hackerati.]

In our deepnightmares, we’ve seen monstrous slugdogs, shoggoths of endless eyes, creatures beyond all reckoning. Wherever we look, a dog’s face stares back at us, with their cohort of unflinching finches, all beaks and eyes. We try to escape into different layers, but we are still confronted with monsters of lizards, trypophobia-inducing insects, skin melting into panflutes, mouths melting into tennis balls. Is there no hope?

image

Continue reading Deepdreaming Without the Slugdogs

A Thousand Years of the Painted Face

[Cross-posted at The Hackerati.]

imageimageimage

Humans have always been compelled by faces. We like to look at them, we like to draw them, we like to take pictures of our own face, we see them in the moon and in our toast and in a random outcropping of rocks. We look at a friend’s face and instantly know what she’s feeling. We look at a 700-year-old painting of a face and we can feel what that person’s world is like on the inside.

Our depiction of the human face hasn’t remained constant, however. Using a technique called face averaging, we can see how the art of the face has evolved.

Continue reading A Thousand Years of the Painted Face

Settlers of Catan Penrose Tiles

Tired of hexagons? Try playing Settlers of Catan with some Penrose Tiles! Print out as many as you need, then cut along the black lines. When placing tiles (either initial placement or later fog-of-war placement) the little blue and yellow marks MUST match up with the marks of an adjacent tile!

Click to enlarge.