The New York City Education Department will release the ratings of thousands of teachers on Friday, ending a nearly year-and-a-half-long legal battle by the teachers’ union to keep the names confidential.

The ratings, known as Teacher Data Reports, grade nearly 18,000 of the city’s 75,000 public school teachers based on how much progress their students have made on standardized tests. The city developed these so-called value-added ratings five years ago in a pilot program to improve instruction and has factored them into yearly teacher evaluations and tenure decisions.

Even before their release, the ratings have been assailed by independent experts, school administrators and teachers who say there are large margins of error — because they are based on small amounts of data, the test scores themselves were determined by the state to have been inflated, and there were factual errors or omissions, among other problems.

The union, the United Federation of Teachers, is responding to the release with a $100,000-plus newspaper advertising campaign starting on Friday. With the headline “This Is No Way to Rate a Teacher,” the advertisements will feature an open letter from the union president, Michael Mulgrew, that displays a complex mathematical formula followed by a checklist of reasons why the ratings are problematic.