MOCKING economists is easy sport. They try to predict the future yet missed the 2008 crash, and make bizarre assumptions that cannot hold true. Other offences on the checklist include their narrow academic outlook and lack of exposure to the “real world” of business. The onslaught is common, and hard to refute. But at a turning point the herd tends to be wrong. Economics is evolving, with a mission to solve firms’ real-life problems at its heart. Not unusually, the innovation is most obvious—for now—in Silicon Valley.

For Bryan Balin of SmarterTravel, a subsidiary of TripAdvisor, a travel website, economics has to be lightning quick. Only 1% of a typical travel site’s visitors buy a flight, hotel or holiday before browsing away. Popular vendors can have a lot of viewer flow, but take revenues from only a tiny fraction of them. It is paramount to sift the buying wheat—to be guided as quickly as possible to the product they want—from the window-shopping chaff, who can be bombarded with advertising for other products, lifting the website’s profit.

Mr Balin helps crack that problem. In the first few seconds a visitor spends on SmarterTravel’s site an algorithm builds a picture of them. Click speed helps: window-shoppers tend to skip quickly between pages, serious buyers ponder for longer. Other data including the time of day, number of previous visits and location are important. The algorithm spits out the probability that the user is a potential buyer. With that, it calculates the revenue gains and risks (of distracting shoppers) associated with showing adverts. The site is adjusted in a few milliseconds.

Spotting helpful patterns when you are swimming in data is tough, explains Genevieve Graves, an astrophysicist turned data scientist. Her training put her in good place: while doing research at Princeton Ms Graves toiled with the Sloan Digital Sky Survey, a vast data set containing information on the location of stars and galaxies. Today she analyses something much more down to earth: human resources. The empirical technique she employs at hiQ Labs, a startup based in San Francisco, known as “machine learning”, is at the core of the new world of business economics.

Machine learning is not as scary as generations of science-fiction writers have made it sound. The basic aim, set out by Arthur Samuel in 1959, is to get computers to teach themselves. To do this a programmer tells a machine to perform a task repeatedly, measuring its success against some yardstick. Next the computer changes tack slightly, measuring whether it did better or worse, repeating this loop until it “learns” how to complete the task well. Run through enough attempts and a computer can set spam filters, turn voice recordings and fly a helicopter.

The data team at hiQ Labs reckons machine learning can revolutionise business. For most firms the cost of losing a senior employee is far greater than keeping existing workers happy. Leavers take knowledge and contacts with them and often induce loyal underlings to follow them out the door. In response big firms try to identify angst building in the workforce, using staff-wide surveys and blanket interviews to spot dissatisfaction. The result of this approach—a pay rise here, tax-free bikes or child care vouchers there—are then rolled out across all staff.

This blanket approach could be improved if firms knew who was most at risk of leaving, says Ms Graves. Algorithms devised by hiQ Labs solve this. Using a firm’s in-house data—from pay scales to organograms and job titles—and comparing it with information on pay and vacancies in competitor firms, it can predict who might defect, and for what reason. Managers then hone in on the potential deserters, offering a tailored solution which often turns out to be something other than a pay rise.

Divining hidden “types”—the buyer and the browsers, the content and the disgruntled—is a common challenge in the new realm of economics, says Scott Nicholson, a Stanford economics PhD advising hiQ. The reason is that new firms are often platforms on which buyers and sellers meet. His previous employers, LinkedIn (workers and employers) and Accretive Heath (doctors and patients) did a similar thing. In all these outfits, knowing more about a customer’s type can help the platform suggest a better link.

Poynt, a cashless payment terminal (and Mr Nicholson’s latest employer) also follows this model. Beyond acceptingcredit-card payments, Poynt hopes to provide a better connection between shopkeepers and their customers, and between the shops themselves. Linking together tills, for example, will in theory enable stores to compare themselves to anonymised local rivals (and so answer the retailer’s perennial question: are all local shops doing badly, or is it just me?) A more mundane use would be to track sales and customer retention, potentially against peers. This sort of benchmarking was once firmly the preserve of blue-chip companies.

A better broker

Helping to get a new platform off the ground is a challenge, explains Riley Newman, head of economics at Airbnb. The specific challenge faced by his firm, which links “hosts” (property owners wanting to let their home) and “guests” (those looking for a place to stay) was getting supply and demand lined up. New York and San Francisco were so popular with visitors that the supply of hosts fell short. Facebook ads, which can be locally targeted, boosted supply. Boston and Portland had plenty of willing hosts but little demand. Google ads, targeted at people thought likely to visit these cities, lifted demand.

With the platform up and running Mr Newman and his team tried to make it work better. Its hosts—homeowners rather than professional hoteliers—are playing an unfamiliar role. Early on it became clear that some hosts were doing better than others. Crunching through data, it found the quality of photos of a host’s abode was a key factor in their hit-rate. So Airbnb tested providing a free photography service to those offering accommodation, reasoning that better demand might offset the cost. The results were positive and Airbnb now offers free professional photos to most hosts.

In adapting products to match supply and demand, this new breed is injecting economics into the structure of Silicon Valley firms. While they are too busy to realise it such firms are also providing the best defence of economics against its critics. Far from being unrealistic and out of touch, the role of chief economist will design the way that the firm works.