AI Methods I · Team 1 · IAAC Barcelona

We followed one question from messy data to a working tool: which facades in New York are unsafe, and what is wrong with them? One term, four weeks, and a new method every week: data cleaning, prediction, clustering and neural networks. This is the whole course in one story: what we built, what worked, and what didn’t.

Where each of the six facade typologies sits in New York City. Grey dots are all other buildings in the filing records.
Where each of the six facade typologies sits in New York City. Grey dots are all other buildings in the filing records.

HOW TO READ IT
Each small map is one family of buildings. Coloured dots belong to that family, grey dots are every other building. Plain brick (orange) is everywhere, pre-war terra cotta and stone (green) packs into Manhattan, and the glass and metal towers (brown) cluster in Midtown and Downtown.

288

survey rows left after cleaning

54,049

facade filings

15,763

buildings clustered

2,950

photos of defects

01

WEEK 1 · DATA CLEANING AND EXPLORATION

Clean first. Conclude later.

Fix the data before trusting any conclusion.

THE STORY

We began with a survey of 300 students and professionals about how they use AI: tool, purpose, hours per day, cost, productivity and satisfaction. It was messier than it looked. Hours were stored as text (“2 hrs”), the same AI tool was spelled several ways, countries and education levels had variants, and 12 rows were exact duplicates. We parsed every number, unified the labels, removed the duplicates (288 rows left) and checked what was missing (age was worst, at 7.7%).

Then we asked questions. People who use AI more report higher productivity (correlation 0.66) and more hours saved per week (0.78). Students and professionals look almost the same (3.0 and 2.9 hours a day). Monthly cost barely moves with usage (0.03) or income (−0.05), and the median cost is zero for both groups. One respondent claims 23 hours a day, which we flagged instead of hiding. These are associations in a small survey, not proof that AI use causes better results.

THE NUMBERS

A survey of 300 people. 12 duplicates removed, labels unified, outlier flagged.

0.66

daily AI hours vs productivity

0.03

AI hours vs monthly cost

THE VISUALS · WHAT EACH CHART SHOWS

Daily AI hours against productivity score. The lone point at 23 hours is the outlier we flagged.
Daily AI hours against productivity score. The lone point at 23 hours is the outlier we flagged.

HOW TO READ IT
Each dot is one person. The line slopes up: the more hours of AI a day, the higher the productivity score people report (correlation 0.66). The lone dot at 23 hours a day is an extreme answer we flagged, because one point like that can bend a line.

Students and professionals compared on usage, time saved, cost and ratings: broadly similar.
Students and professionals compared on usage, time saved, cost and ratings: broadly similar.

HOW TO READ IT
Six small charts, students against professionals. The boxes almost overlap: both groups use AI, save time and rate it in much the same way. Cost is the odd one out. The middle value is zero for both, because most people pay nothing.

02

WEEK 2 · SUPERVISED LEARNING

The laziest answer was hard to beat.

Can a model tell which facades are unsafe?

THE STORY

New York requires every large building to have its facade inspected, and each filing ends SAFE, SWARMP or UNSAFE. From 54,049 initial filings on 15,767 buildings we trained models to predict which filings come back UNSAFE (23% of them). We removed anything that leaks the answer (amended filings, penalties, dates) and split the data by building, so a building never appears on both sides.

Before any model, we wrote down the laziest rule: call everything UNSAFE. Because we score with F2, which rewards finding unsafe facades over being precise, that rule already scores 0.60. Logistic regression, a decision tree, a random forest and gradient boosting all landed around 0.55 in cross-validation. The random forest, with the decision threshold lowered to 0.30, scored F2 0.63 on unseen buildings: it finds 92% of the UNSAFE facades, at a precision of 0.28.

The more useful number is the ranking. Inspecting the riskiest 10% of filings finds 34% of the UNSAFE ones, 3.4 times better than chance, and the riskiest 20% finds 49%. The model still misses 8% of UNSAFE facades, including 21% of buildings whose last result was SAFE. Mostly it learns that a building which was unsafe before is unsafe again.

THE NUMBERS

23%

of filings UNSAFE

0.60

F2 of “flag everything”

0.63

F2 of our final model

34%

of UNSAFE in the riskiest 10%

THE VISUALS · WHAT EACH CHART SHOWS

Models compared by cross-validated F2, next to the trivial baselines.
Models compared by cross-validated F2, next to the trivial baselines.

HOW TO READ IT
Left: the score of each model, higher is better. Four real models land around 0.55, while the lazy rule “call everything UNSAFE” scores 0.60. Right: red is the share of unsafe facades found, grey is the share of alarms that were right. Flagging everything finds them all, but only about one alarm in four is correct.

If inspectors went through buildings riskiest-first, the top 20% would hold 49% of the UNSAFE facades.
If inspectors went through buildings riskiest-first, the top 20% would hold 49% of the UNSAFE facades.

HOW TO READ IT
Picture inspectors going through the city riskiest-first. The blue line is our model, the dashed grey line is random order, the dotted green line is a perfect ranking. After checking the top 20% of buildings, we have already found 49% of the unsafe ones.

What the model misses: buildings with no previous report and glass or metal facades.
What the model misses: buildings with no previous report and glass or metal facades.

HOW TO READ IT
Where the model is blind. Left: unsafe facades it missed, by what the previous report said. It misses 40% of buildings with no report on file and 21% of buildings once rated SAFE. Right: by material. Glass facades are missed most, about one in four.

03

WEEK 3 · UNSUPERVISED LEARNING

New York has six kinds of facade.

Let the machine find the groups on its own.

THE STORY

This time we gave the machine no labels. For 15,763 buildings we combined the filing history with the city’s PLUTO building data and fed K-Means thirteen features: how often a building was UNSAFE, penalties, number of cycles and the facade materials. A PCA kept 8 components for 80% of the variance, and t-SNE helped us look at the result.

The honest part: silhouette scores sit between 0.17 and 0.20 for every k from 3 to 12, so the data does not announce a number of groups. We chose six because they are stable (ARI 0.86 across seeds, 0.83 on 80% subsamples) and because we could name them: non-masonry or unreported facades (6.5%), plain low-risk brick (38.4%), pre-war terra cotta and stone (20.7%, 88% in Manhattan), post-war concrete and brick (10.7%), modern glass and metal curtain walls (8.7%) and repeatedly unsafe brick (14.9%). That last group is UNSAFE in 68% of its inspections and sits mostly in the Bronx and Upper Manhattan. Year built, floors and borough were never given to the model; we used them afterwards to check the names.

THE NUMBERS

15,763

buildings

6

typologies

0.86

stability across seeds (ARI)

0.17–0.20

silhouette, no clear k

THE VISUALS · WHAT EACH CHART SHOWS

The six clusters: size and average profile on each feature.
The six clusters: size and average profile on each feature.

HOW TO READ IT
Left: how many buildings sit in each cluster. Right: the average profile of each one. Dark red means far above the city average, dark blue far below. Cluster 4 glows on “share UNSAFE” and follow-ups: the repeat offenders. Cluster 5 glows on glass and metal: the modern towers.

The clusters on the PCA map and on the t-SNE map.
The clusters on the PCA map and on the t-SNE map.

HOW TO READ IT
The same buildings, squashed from thirteen measurements onto a flat page, twice (PCA on the left, t-SNE on the right). Each colour is a cluster and neighbours are similar buildings. The groups touch and overlap a little, which is why we call them typologies and not hard boxes.

04

WEEK 4 · NEURAL NETWORKS

We taught a small network to see cracks.

Teach a network to spot defects in photos and video.

THE STORY

Week 2 told us which buildings; week 4 asked what is wrong with them. We fine-tuned YOLO26n, a small object detector, on 2,950 photos with five defect classes (crack, stair-step crack, peeling paint, water seepage and mold), and used SAM to outline the defects. We built our own split by image source so near-duplicates stay on one side, and blurred the 6 faces we found in the data.

The baselines set the bar: a general-purpose YOLO found nothing, and a rule-based OpenCV crack detector reached 0.41 precision and 0.45 recall. Our network finds 92% of cracks at 0.71 precision, and 81% of all defect boxes on the test set. Experiments taught us one practical thing: a model at 320 pixels was as good as at 640 and trained three times faster.

It is not good at everything. Cracks (AP50 0.93) and stair-step cracks (0.77) work. Mold (0.29), water seepage (0.28) and peeling paint (0.05) do not, and 29% of water seepage is called peeling paint. On three videos it followed a crack along a plastered wall in every frame, while a derelict apartment produced false alarms such as a mop bucket. Most of our training photos are close-ups of cracks, so we trust the crack results and not the rest.

THE NUMBERS

0.93

AP50 for cracks

0.05

AP50 for peeling paint

Average precision per class on the test set.
Average precision per class on the test set.

HOW TO READ IT
How well each defect is found, from 0 to 1. Cracks (0.93) and stair-step cracks (0.77) are solid. Mold, water seepage and peeling paint are weak: few examples, and they look alike.

THE VISUALS · WHAT EACH CHART SHOWS

Predictions (bottom) against the true boxes (top) on test images.
Predictions (bottom) against the true boxes (top) on test images.

HOW TO READ IT
Top row: the defects people marked. Bottom row: what our network found. Cracks match almost exactly. On stained and peeling walls it draws more boxes than people did, which is why we ask a person to confirm every detection.

Press play: the three annotated videos below show where the detector works and where it fails.

Cracked plaster: the crack is found in every frame and traced along its whole length (red).
Brick wall: the damage is recognised only in some frames, and often at low confidence. This is where a person has to look.
False-alarm test in a derelict apartment: low-confidence detections, such as a mop bucket read as peeling paint.
Detection and segmentation on three videos, with the defect area over time.
Detection and segmentation on three videos, with the defect area over time.

HOW TO READ IT
Three clips, three frames each, and on the right how much of the picture is flagged over time. Plaster: a steady line. Brick: it flickers on and off. Derelict apartment: spikes that are false alarms.

·

Four things we’ll keep.

Cleaning decides everything that follows. A trivial baseline tells you whether a model has learned anything. Clusters need to be tested for stability and named with data the model never saw. And a detector is only as good as the photos it was trained on. The four weeks fit together: the survey taught us to doubt a result, the facade filings told us which buildings, the clusters told us what kind, and the detector told us what to look for.

We used Claude Code as a coding agent through the course, and checked its results against the notebooks and figures.

Data: DOB NOW Safety, Facades Compliance Filings and PLUTO (NYC Open Data); the crack dataset from Roboflow (CC BY 4.0); the week 1 survey of AI use among students and professionals.

Code: supervised learning, unsupervised learning and neural networks on github.com/iaac-maai, and the week 1 repository. Models on Hugging Face: unsafe-facade predictor, facade typologies and building defect detector.