Chris Moody knows a thing or two about the universe. As an astrophysicist, he built galaxy simulations, using supercomputers to model the way the universe expands and how galaxies crash into one another. One night, not long after he’d finished his PhD at UC Santa Cruz, he met up with a few other astrophysicists for beers. But that night, no one was talking about galaxies. Instead, they were talking about fashion.

A couple of Moody’s astrophysicist pals had recently left academia to work for Stitch Fix, the online personal styling company now valued at $2 billion. Moody gawked at them. “They were like, ‘You don’t think this is an interesting problem?’” he says. Indeed, he did not. But when his friends described the work they were doing—sprinkling in phrases like “Bayesian models” and “Poincaré space”—predicting what clothes someone might like started to sound eerily like the work he’d done during his PhD. Quantifying style, he discovered, “turns out to have really close analogues to how general relativity works.”

Four years later, Moody works for Stitch Fix too. He belongs to a growing group of astrophysicist deserters, who have stopped researching the cosmos to start building recommendation algorithms and data models for the tech industry. They make up the data science teams at companies like Netflix and Spotify and Google. And even at elite universities, fewer astrophysics PhDs go on to take postdoctoral fellowships or pursue competitive professorships. Now, more of them go straight to work in Silicon Valley.

To understand what’s driving astrophysicists into consumer product startups, consider the recent explosion of machine learning. Astrophysicists, who wrangle massive amounts of data collected from high-powered telescopes that survey the sky, have long used machine learning models, which “train” computers to perform tasks based on examples. Tell a computer what to recognize in one intergalactic snapshot and it can do the same for 30 million more and start to make predictions. But machine learning can also be used to make predictions about customers, and around 2012, corporations started to staff up with people who knew how to deploy it.

These days, machine learning drives everything from Stitch Fix’s curated boxes of clothes to Netflix’s personalized movie recommendations. How does Spotify perfectly predict the songs that will surprise and delight you in its weekly personalized playlists? That's machine learning at work. And while machine learning now constitutes its own field of study, because scientists from fields like astrophysicists have been working with those kinds of models for years, they’re natural hires on data science teams.

“We were already in Big Data before Big Data became a thing,” says Sudeep Das, an astrophysicist who now works at Netflix.

Das got his PhD at Princeton, where he researched cosmic microwave background—basically the electromagnetic radiation left over from the Big Bang. Afterward, he spent a few years studying data from the Atacama Cosmology Telescope in Chile. The telescope collects nearly a terabyte of data from the cosmos every night, and from this massive data set, Das detected an elusive astrophysical signal. It was a rare payoff after years of painstaking work. The discovery earned him the attention of the University of Michigan, which offered him an assistant professorship.

But Das turned it down and moved to Silicon Valley instead—first to work as a data scientist at Beats Music, then at OpenTable, and now at Netflix.

The decision to leave academia came down to a few factors: The pay was certainly better, and the jobs were more plentiful. “There’s a bottleneck of getting into tenure-track positions,” he says. And being in the Bay Area meant he and his wife—who is also an astrophysicist—would never have to worry about both finding jobs. But the real surprise, he says, was that the work in tech companies was actually interesting. At Beats, he says, he found “like-minded people who were working on problems that didn’t take away the intellectual high.” Same math, different application.