There’s a story Brett Goldstein likes to tell. It starts on a Friday night in 2010 with him sitting in a darkened Crown Victoria on a Chicago street. Goldstein was a commander at the Chicago Police Department, in charge of a small unit using data analysis to predict where certain types of crimes were likely to occur at any time.

Earlier that day, his computer models forecast a heightened probability of violence on a particular South Side block. Now that he and his partner were there, Goldstein was doubting himself.

“It didn’t look like it should be a target for a shooting,” he recalled. “The houses looked great. Everything was well manicured. You expect, if you’re in this neighborhood, you’re looking for abandoned buildings, you’re looking for people selling dope. I saw none of that.”

Still, they staked it out. Goldstein’s wife had just given birth to their second child, and he was exhausted. He started to doze off. Goldstein’s partner argued that the data must be wrong. At 11 p.m., they left.

Several hours later, Goldstein woke up to a Blackberry alert: There had been a shooting on the block where he’d been camped out.

“This sticks with me because we thought we shouldn’t be there, but the computer thought we should be there,” Goldstein said. He took it as vindication of his vision for the future of law enforcement. “I do believe in a policeman’s gut. But I also believe in augmenting his or her gut.”

Seven years later, Goldstein threw on a gray suit and headed from his Manhattan hotel to New Jersey. Last spring he founded CivicScape, a technology company that sells crime-predicting software to police departments. Nine cities, including four of the country’s 35 largest cities by population, are using or implementing the software, at an annual cost from $30,000 for cities with fewer than 100,000 people to $155,000 in cities with populations over 1 million. Goldstein was checking in on the two clients who were furthest along: the police departments in Camden and Linden.

Today, almost every major U.S. police department is using or has used some form of commercial software that makes crime predictions, to determine what blocks warrant heightened police presence or which people are most likely to be involved. Technology is transforming the craft of policing.

Not everyone is rubbing their hands in anticipation. Many police officers still see so-called predictive policing software as mumbo jumbo. Critics outside law enforcement say it’s actively destructive. The historical information these programs use to predict patterns of crime aren’t a neutral recounting of objective fact; they’re a reflection of socioeconomic disparities and the aggressive policing of black neighborhoods. Others mock it as pseudoscience.

“Systems that manufacture unexplained ‘threat’ assessments have no valid place in constitutional policing,” a coalition of civil rights and technology associations, including the ACLU, the Brennan Center for Justice, and the Center for Democracy & Technology, wrote in a statement last summer.

A numbing progression of police shootings in the past several years serve as a reminder of what’s at stake when police officers see certain communities as disproportionately threatening. The worst-case scenario with predictive policing software is deploying officers to target areas with their ears raised, leading them to turn violent in what would otherwise be routine encounters.

Goldstein’s company does make one unusual promise, which it thinks can satisfy skeptics in law enforcement and civil rights circles simultaneously. Other companies that make predictive software for criminal justice settings keep their algorithms secret for competitive reasons. In March, CivicScape published its code on GitHub, a website where computer programmers post and critique one another’s work. The unprecedented move caused an immediate stir among people who follow the cop tech industry.

“They’re doing all the things I’ve been screaming about for years,” said Andrew Ferguson, a professor at the University of the District of Columbia’s law school and author of the forthcoming book, “The Rise of Big Data Policing.”

Posting computer code online won’t erase the worries about predictive policing. There are still concerns about how CivicScape responds to perceived shortcomings, and there’s also the big question of what police departments do with the intelligence it produces. But more than any other company, CivicScape has turned itself into a test case for what it means for law enforcement to use artificial intelligence in a way that’s transparent and accountable-and whether that’s even possible.

Goldstein, 43, didn’t start off wanting to be a cop. He was director of information technology at Open Table, the online restaurant reservation company, but after 9/11 he began to question the significance of that work. In 2004, Goldstein saw an advertisement for the Chicago Police Department’s entry exam, took it and did well. He left Open Table in 2006.

After 13 months as a beat cop, Goldstein was promoted to commander and put in charge of a new unit running computer models to anticipate where crime would happen. The unit was providing intelligence that far exceeded what it had been using before, according to Michael Masters, who first met Goldstein during his academy days when Masters was an adviser to Mayor Richard M. Daley, then moved to the police department and now works at CivicScape.

“We were well ahead of our time,” said Masters. Goldstein was perfectly placed to build technology into the daily work of policing. “You don’t have people who were cops, and have ridden in squad cars, building these tools.”

Like any fast riser at a slow-moving institution, Goldstein was a polarizing figure. There were rumors that he had some family connections at City Hall, and he had trouble developing any tough-guy credibility — even after he caught a shooter who killed a man in front of Goldstein’s family on his day off. Longtime officers thought it was both simple to predict broad patterns of crime, which consistently centered on the same areas of the city, and impossible to anticipate specific offenses. Goldstein’s critics would gloat when a shooting occurred a block from one of his target areas, and they’d occasionally berate him in person at headquarters.

Goldstein admitted he failed to win over his critics, and his unit was disbanded when the head of the department stepped down in 2011. And he acknowledged that he never developed a rigorous way to test his techniques’ impact on crime rates. Goldstein moved to City Hall, then left government in 2013. Since then, Goldstein has run a venture capital fund, held academic positions and sat on the board of Code for America, a nonprofit dedicated to help governments use technology.

The Camden County Police Department’s Real-Time Tactical Operation Intelligence Center is a Rorschach test on how you feel about tech in law enforcement. The RT-TOIC, as it’s known, is a windowless room from which the department runs its technological initiatives. The department’s leaders think the RT-TOIC represents the future of policing, not just in Camden, but everywhere.

When Goldstein visited this month, about a dozen people were at work inside, most sitting at stations displaying four to six computer screens. Large screens showing maps and footage from surveillance cameras were displayed on the wall. Analysts monitored social media for accounts that have referred to crimes.

Camden integrated CivicScape into the RT-TOIC three months ago. The company’s maps change hourly to reflect updated data. Officers translate what’s happening in the RT-TOIC to officers on the street. Cops in patrol cars don’t know whether an order is derived from newfangled math, the judgment of a superior officer or a mixture — a deliberate ambiguity, said Kerry Yerico, the department’s director of criminal intelligence and analysis.

On the day of Goldstein’s visit, Yerico and Lt. Jeremy Merck, the watch commander on duty, were discussing an area CivicScape had flagged. Merck immediately recognized the area — his officers had said that drug dealers were ramping up operations there. They had deployed extra officers. Neither Yerico nor Merck knew exactly how the department’s computers and humans had homed in on the same spot.

The guts of CivicScape’s predictive system are a series of neural networks. Neural networks, named because their design mimics the structure of neurons in the human brain, examine large data sets in which the inputs and outcomes are labeled. They then determine patterns they can use to predict what will happen when presented with new data. In CivicScape’s case, the inputs are the historical data sets provided by their clients, and the outcomes are past crimes.

Neural networks are favored by computer scientists working with huge data sets, but one of their shortcomings is their opaqueness. Unlike an algorithm in which a human has consciously told the system what to think about each factor, neural networks find their own paths and can’t effectively explain to humans what they’ve done. This can make CivicScape even less transparent than other predictive policing software, which use different types of algorithms.

Scott Thompson, Camden’s police chief, said he hasn’t heard any criticism about transparency. For its part, CivicScape said its openness comes from inviting discussion about the types of data its models use. For instance, the company decided against using arrests for marijuana possession at all, given research showing racial disparities in these arrests.

Kristian Lum and William Isaac, researchers who have written their own statistical models for the Human Rights Data Analysis Group demonstrating how bias works in predictive policing, have examined the code. They both described CivicScape’s move as positive but withheld praise until they see how the company followed through.

A significant shortcoming with CivicScape’s code repository, said Isaac, is that it has posted generic code when in practice it adapts its system for each separate client. Goldstein acknowledged that his clients will not allow him to share some of the data that he’s using to produce predictions. It’s hard for an observer to assess what an algorithm does without access to either the final version of the code or a full set of the data.

“I think it’s a straddle” between the desires of police departments and the public, said Goldstein. “I’d rather take this step and move forward than not take a step because we know there are imperfections.”

Linden, like many of CivicScape’s clients, is a small department going through a transition. Chief Jonathan Parham started in late 2016 after a yearlong cloud hung over the department for its response to an officer causing a fatal car crash after a boozy evening at a Staten Island strip club. Parham is a 25-year veteran of the force and its first African-American chief. He also thinks police departments have overemphasized arresting people.

Parham said he sees predictive policing as a way to offset brain drain. A lack of experience in the department has left Linden’s officers without a basic understanding of its communities. “We’re looking at the absence of personal knowledge of your area and supplementing that with technical knowledge of the frequency of the crimes,” said Parham.

Camden’s department cited a similar need. The cameras, social media analysis and automated forecasting are all supposed to help the department cover the most ground with the fewest officers.

To Isaac, the researcher, it’s a myopic way to approach criminal justice. The potential advantages of predictive tech are undermined by restricting it to something that cops use to catch supposed bad guys, he maintains.

“What you are left with is a perceived chess match between cops and robbers,” Isaac said. “That’s a very simplistic version of what crime really is.”

Parham offered a similar view. The worst thing Linden’s police department could do, he argued, was to believe that Goldstein really did have mystical math that would allow officers to drive to the specific location of shootings just as they were about to occur.

Parham recalled a training exercise he helped run: Officers were sent to a train station and told to interview people in the station, to treat people as more than potential perps. After 10 minutes, each officer would write down what he had learned. The winner was the person with the most useful information.

The officers logging the most arrests always performed the worst, Parham said. If law enforcement is a matter of receiving a target from a computer and then attacking that target, it doesn’t matter how precise the computer model is. Parham’s job is to produce cops who are better at the train station drill.

“Our officers, the more technologically savvy they get, the less human they become,” said Parham. “I don’t want that.”