{"title":"City Fish","link":[{"@attributes":{"href":"https:\/\/casyfill.github.io\/","rel":"alternate"}},{"@attributes":{"href":"https:\/\/casyfill.github.io\/feeds\/all.atom.xml","rel":"self"}}],"id":"https:\/\/casyfill.github.io\/","updated":"2026-11-18T00:00:00-05:00","entry":[{"title":"Mapping my travels, again, but better","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/travel-maps\/","rel":"alternate"}},"published":"2026-11-18T00:00:00-05:00","updated":"2026-11-18T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2026-11-18:\/travel-maps\/","summary":"<p><em>Why I keep drawing maps of my trips \u2014 and how my notes finally started drawing them for me.<\/em><\/p>\n<hr>\n<p>I was 14 when the first member of my family went abroad. It was my Mom \u2014 she got onto a government-sponsored trip to Turkish Cyprus. It took another five years for me \u2026<\/p>","content":"<p><em>Why I keep drawing maps of my trips \u2014 and how my notes finally started drawing them for me.<\/em><\/p>\n<hr>\n<p>I was 14 when the first member of my family went abroad. It was my Mom \u2014 she got onto a government-sponsored trip to Turkish Cyprus. It took another five years for me to finally go abroad myself. Perhaps this delayed, long-awaited experience made me strive for each trip to be The Journey.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/mapping_travel\/costa-rica-2014-mapbox-studio.png\" alt=\"A hand-styled map of Costa Rica with a wave-textured ocean, contour lines, and seven numbered stops from San Jos\u00e9 to Tortuguero\">\n<strong>Costa Rica, 2014.<\/strong> Made in Mapbox Studio, the successor to <a href=\"https:\/\/tilemill-project.github.io\/tilemill\/\">TileMill<\/a>. One of my early attempts \u2014 naive and imperfect; checking it now, I even found a few destinations placed incorrectly, and I'm not sure how that happened.<\/div>\n\n<p>A month roving India, north to south. Two month-long trips roving Costa Rica, eleven years apart. Zigging and zagging through the Italian Alps. Those long travels do change your experience and sense of life, and provide an immense number of stories.<\/p>\n<p>And planning trips, facing travel challenges and making decisions does feel empowering, somehow bringing me closer to the heroes of my childhood books: Cyrus Smith, Phileas Fogg, Richard Francis Burton. I guess that's why I've long been trying to record my travels and map them \u2014 not (only) as a visual testament, but also as an index, of sorts, linking all the stories, challenges, thoughts and emotions.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/mapping_travel\/photobook-costa-rica-2025.jpg\" alt=\"An open photobook: a map of the southern Nicoya Peninsula on the left page; on the right, a list of each traveler's top three memories and photos of handwritten notebook pages\">\n<strong>Costa Rica, 2025.<\/strong> A spread from our family photobook: the map, made in QGIS, next to everyone's top three memories of the trip.<\/div>\n\n<p>Yet drawing those maps, while rewarding, took time, and I didn't have much of an audience to share them with. That changed when I became a father \u2014 from then on, maps became a part of the photobooks from our shared travels.<\/p>\n<p>Of course, when I started using Obsidian to keep track of all my life in one place, travel plans and records were an obvious part of the migration. Details, arrangements, budgets, places to visit and travel logs \u2014 all were part of it from the start.<\/p>\n<p>But the data visualisation part was lacking. With <a href=\"\/agate\/\">Agate<\/a>, the plugin I built, that changed. With some tinkering, experimentation and inquiries to Claude, I was able to create a single map spec <del>to rule them all<\/del> that shows the itinerary of any trip I've had, on a map. Another spec, on top of the same data, shows the most important statistics.<\/p>\n<figure><img src=\"\/static\/mapping_travel\/agate-costa-rica-and-georgia.png\" alt=\"Two Obsidian notes side by side. Left: Travel - Costa Rica Summer 2025, a map of the Nicoya peninsula with two numbered stays, routes shaded from first to last leg, and icons for experiences like snorkeling, scuba diving and a turtle nursery, above a By the numbers block reading 38 days, $8,176 spent, 293 km travelled, with top highlights. Right: AT Georgia 2025, a hiking route over shaded terrain, above stacked charts of elevation, speed, heart rate, sun and temperature\">\n<figcaption>Two notes, drawn by Agate. Left: Costa Rica, summer 2025 \u2014 the route leg by leg with icons for experiences, and the trip by the numbers. Right: three days on the Appalachian Trail in Georgia, 2025 \u2014 the route over terrain, with elevation, speed, heart rate, sun and weather along the way. Tools: Obsidian, Agate \u00b7 Basemap: MapTiler \u00b7 Icons: custom CSS<\/figcaption><\/figure>\n\n<p>I am pretty happy with the result. Still, I am a bit concerned that the trips look almost cookie-cutter, and I am not fully satisfied with the free-tier MapTiler basemaps (labels get in the way). Perhaps another layer of information would help \u2014 iconography for experiences, top photos (that would require setting up private URLs and private image hosting within my network, a separate piece of work). All of it is yet to come.<\/p>","category":{"@attributes":{"term":"Personal"}}},{"title":"Agate: an Obsidian plugin that turns Bases into data visualizations with Vega","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/agate\/","rel":"alternate"}},"published":"2026-11-12T00:00:00-05:00","updated":"2026-11-12T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2026-11-12:\/agate\/","summary":"<figure><img src=\"\/static\/agate\/base-to-chart.jpg\" alt=\"A base of book notes on the left; the same notes drawn as a chart on the right, with one row linked to its block\">\n<figcaption>The same notes, twice: as rows in a base, and as a chart. Each block is one book note; hovering it shows the note's properties.<\/figcaption><\/figure>\n\n<h2>What it is<\/h2>\n<p><a href=\"https:\/\/casyfill.github.io\/Agate\/\">Agate<\/a> is a plugin for Obsidian that draws charts from your notes. It adds an <strong>Agate chart<\/strong> view to Bases: the base \u2026<\/p>","content":"<figure><img src=\"\/static\/agate\/base-to-chart.jpg\" alt=\"A base of book notes on the left; the same notes drawn as a chart on the right, with one row linked to its block\">\n<figcaption>The same notes, twice: as rows in a base, and as a chart. Each block is one book note; hovering it shows the note's properties.<\/figcaption><\/figure>\n\n<h2>What it is<\/h2>\n<p><a href=\"https:\/\/casyfill.github.io\/Agate\/\">Agate<\/a> is a plugin for Obsidian that draws charts from your notes. It adds an <strong>Agate chart<\/strong> view to Bases: the base picks the notes, a Vega or Vega-Lite spec describes the picture, and the chart redraws when the notes or the base's filters change.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/agate\/obsidian-app.png\" alt=\"Obsidian on desktop and phone: a folder of notes, an open note, and its link graph\">\n<strong>Obsidian.<\/strong> Notes, folders and the links between them, on desktop and mobile. <a href=\"https:\/\/obsidian.md\">obsidian.md<\/a><\/div>\n\n<p><a href=\"https:\/\/obsidian.md\">Obsidian<\/a> is a note-taking app that keeps notes as plain Markdown files in a local folder, called a vault. Notes can carry properties \u2014 a date, a rating, a place, a link to another note. <strong>Bases<\/strong>, a core Obsidian feature, queries notes by those properties and shows them as a table you can filter, sort and group, much like a small database.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/agate\/vega-lite-example.png\" alt=\"A Vega-Lite bar chart of mean monthly precipitation in Seattle, next to the twelve-line JSON spec that draws it\">\n<strong>Vega-Lite.<\/strong> Twelve lines of JSON \u2014 data, mark, encoding \u2014 and the chart they draw. <a href=\"https:\/\/vega.github.io\/vega-lite\/examples\/\">Vega-Lite examples<\/a><\/div>\n\n<p><a href=\"https:\/\/vega.github.io\/vega\/\">Vega<\/a> and <a href=\"https:\/\/vega.github.io\/vega-lite\/\">Vega-Lite<\/a> are languages for describing a chart as JSON, developed at the University of Washington's Interactive Data Lab. A spec says where the rows come from, which marks to draw, and which fields map to position, color and size; the library renders it. Vega-Lite is the short form for most charts, Vega the full language underneath.<\/p>\n<div class=\"admonition note\">\n<p class=\"admonition-title\">Install and links<\/p>\n<p>In Obsidian: <em>Settings \u2192 Community plugins \u2192 Browse<\/em>, search <strong>Agate<\/strong>. Needs Obsidian 1.13+ with the core Bases plugin enabled; works on desktop and mobile.<\/p>\n<p><a href=\"https:\/\/casyfill.github.io\/Agate\/\">Website<\/a> \u00b7 <a href=\"https:\/\/casyfill.github.io\/Agate\/quickstart.html\">Quickstart<\/a> \u00b7 <a href=\"https:\/\/casyfill.github.io\/Agate\/gallery.html\">Gallery<\/a> \u00b7 <a href=\"https:\/\/github.com\/Casyfill\/Agate\">GitHub<\/a><\/p>\n<\/div>\n<h2>What to use it for<\/h2>\n<p>To me, Obsidian's main value is its simplicity and flexibility: there is no declared structure or format for your notes. As a result, finding a structure that works is the user's own quest \u2014 a hard one, and never a one-time thing. That's why I wanted Vega here \u2014 a tool I've relied on since at least 2018, when I <a href=\"\/nyc-dataviz-2018\/\">gave a talk about it<\/a>: freedom in how I visualize my notes, combined with charts I can reuse and that stay live as the notes and their structure change.<\/p>\n<p><a href=\"https:\/\/community.obsidian.md\/plugins\/obsidian-vega\">Vega Visualizations<\/a> already renders Vega in Obsidian, but with the data written into the spec. Agate connects it to Bases, and I now use it daily.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/agate\/hike-basemap.jpg\" alt=\"A hiking route drawn over topographic map tiles, with named waypoints\">\n<strong>Outdoors.<\/strong> A three-day section of the Appalachian Trail over terrain tiles, camps and peaks labeled.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/agate\/board-games.jpg\" alt=\"Stacked bars of board-game plays per month by winner, next to a scatter of game length against complexity\">\n<strong>Collections.<\/strong> Game nights by winner, and the shelf by length and complexity \u2014 one note per game and per play.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/agate\/brooklyn-1938.jpg\" alt=\"Brooklyn's 1938 HOLC redlining map, neighborhoods colored by grade\">\n<strong>History.<\/strong> Brooklyn's 1938 HOLC redlining map, drawn from a GeoJSON file with hatched fills.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/agate\/vault-links.jpg\" alt=\"Arc diagram of links between notes, grouped by folder\">\n<strong>The vault itself.<\/strong> Links between notes, grouped by folder.<\/div>\n\n<ul>\n<li><strong>Learning and practice.<\/strong> I keep a note per interview problem, with scores before and after reading up; the chart shows which topics improve and which I keep avoiding.<\/li>\n<li><strong>Travel.<\/strong> Place notes with coordinates, linked from trip notes, become routes on a globe \u2014 mine shows our Azores trip.<\/li>\n<li><strong>Work.<\/strong> I track my goals and OKRs, as well as Jira tickets synced into the vault, thanks to two plugins: <a href=\"https:\/\/community.obsidian.md\/plugins\/obsidian-jira-issue\">Jira Issue<\/a> and <a href=\"https:\/\/community.obsidian.md\/plugins\/jira-weaver\">Jira Weaver<\/a>.<\/li>\n<li><strong>Headline numbers.<\/strong> Big numbers were almost an afterthought; they became the feature I use most.<\/li>\n<li><strong>Collections<\/strong> \u2014 board games, books, records: what gets played or read, and what doesn't.<\/li>\n<li><strong>Habits and mood<\/strong> \u2014 a few numbers in a daily note, accumulated into a year; <a href=\"https:\/\/community.obsidian.md\/plugins\/habit-tracker-21\">Habit Tracker 21<\/a> handles the daily check-ins.<\/li>\n<li><strong>The outdoors<\/strong> \u2014 runs and hikes, with a multi-day route over a basemap.<\/li>\n<li><strong>Campaigns and worlds<\/strong> \u2014 D&amp;D sessions, characters and factions as linked notes.<\/li>\n<li><strong>History<\/strong> \u2014 events with dates and places, or historical maps like Brooklyn's 1938 redlining.<\/li>\n<li><strong>The vault itself<\/strong> \u2014 how notes link, and which folders take up space.<\/li>\n<\/ul>\n<h2>How to start<\/h2>\n<p>The <a href=\"https:\/\/casyfill.github.io\/Agate\/quickstart.html\">quickstart<\/a> walks through a first chart in about fifteen minutes, with a starter set of 26 book notes. In short:<\/p>\n<ol>\n<li>Give your notes consistent properties in the frontmatter \u2014 <code>genre<\/code>, <code>pages<\/code>, <code>status<\/code> \u2014 with numbers as numbers and dates as <code>YYYY-MM-DD<\/code>.<\/li>\n<li>Create a base that picks those notes, e.g. every note with <code>type == \"book\"<\/code>.<\/li>\n<li>Add a chart: in the base, add a view with the <strong>Agate chart<\/strong> layout, then pick one of thirteen recipes, ask an assistant (see below), or write a spec by hand. A spec can also live in any note, inside an <code>```agate<\/code> code block:<\/li>\n<\/ol>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"nt\">base<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"l l-Scalar l-Scalar-Plain\">Reading\/Books.base<\/span>\n<span class=\"nt\">spec<\/span><span class=\"p\">:<\/span>\n<span class=\"w\">  <\/span><span class=\"c1\"># Books per genre, colored by status. Edit a note and this redraws.<\/span>\n<span class=\"w\">  <\/span><span class=\"nt\">mark<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"p p-Indicator\">{<\/span><span class=\"nt\">type<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">bar<\/span><span class=\"p p-Indicator\">,<\/span><span class=\"nt\"> tooltip<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">true<\/span><span class=\"p p-Indicator\">}<\/span>\n<span class=\"w\">  <\/span><span class=\"nt\">encoding<\/span><span class=\"p\">:<\/span>\n<span class=\"w\">    <\/span><span class=\"nt\">y<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"p p-Indicator\">{<\/span><span class=\"nt\">field<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">note.genre<\/span><span class=\"p p-Indicator\">,<\/span><span class=\"nt\"> type<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">nominal<\/span><span class=\"p p-Indicator\">,<\/span><span class=\"nt\"> sort<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"s\">&quot;-x&quot;<\/span><span class=\"p p-Indicator\">}<\/span>\n<span class=\"w\">    <\/span><span class=\"nt\">x<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"p p-Indicator\">{<\/span><span class=\"nt\">aggregate<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">count<\/span><span class=\"p p-Indicator\">,<\/span><span class=\"nt\"> title<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">Books<\/span><span class=\"p p-Indicator\">}<\/span>\n<span class=\"w\">    <\/span><span class=\"nt\">color<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"p p-Indicator\">{<\/span><span class=\"nt\">field<\/span><span class=\"p\">:<\/span><span class=\"w\"> <\/span><span class=\"nv\">note.status<\/span><span class=\"p p-Indicator\">}<\/span>\n<\/code><\/pre><\/div>\n\n<p>Fields are the property ids you see in the base (<code>note.genre<\/code>, <code>file.name<\/code>); the rest is plain Vega-Lite. The chart appears wherever a base does \u2014 its own tab, embedded in a note (<code>![[Books.base#Ratings]]<\/code>), the sidebar, a Canvas \u2014 and clicking a mark opens the note behind it.<\/p>\n<p>The spec is a plain JSON or YAML file next to the notes: it syncs and versions like any other file, and still runs in the Vega editor outside Obsidian. Agate makes no network requests by default; remote data and map tiles load only once you allow them.<\/p>\n<h2>Charting in the age of AI<\/h2>\n<p>Vega and Vega-Lite have been around for over a decade, with plenty of public specs and examples, so language models already know them well: describe a chart in plain words and any capable assistant writes a working spec. That shaped a deliberate choice \u2014 Agate has no chart-builder wizard with panels of options. Most people would ask an LLM anyway, so Agate helps the assistant instead:<\/p>\n<ul>\n<li><strong>Dynamic prompt.<\/strong> <em>Copy prompt for an LLM<\/em> writes a prompt for the current base: its properties and their types, a few sample rows, and Agate's conventions. Paste it into any chat, add what you want, and <em>Paste spec<\/em> checks the reply and saves it as the view's chart (<a href=\"https:\/\/github.com\/Casyfill\/Agate\/blob\/main\/docs\/guide.md#2-your-first-chart-five-minutes\">guide<\/a>).<\/li>\n<li><strong>Theme prompt.<\/strong> <em>Copy theme prompt<\/em> does the same for styling: it reads your current Obsidian theme, so an assistant can write a matching chart theme (<a href=\"https:\/\/github.com\/Casyfill\/Agate\/blob\/main\/docs\/themes.md\">themes<\/a>).<\/li>\n<li><strong>Skill.<\/strong> For agents that work on the vault directly (Claude Code and similar), the <a href=\"https:\/\/github.com\/Casyfill\/Agate\/blob\/main\/skills\/agate-chart\/SKILL.md\"><code>agate-chart<\/code> skill<\/a> teaches Agate's conventions and has the agent render a spec before handing it over.<\/li>\n<\/ul>\n<h2>Extras on top of Vega<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/agate\/5-rollup-numbers.jpg\" alt=\"Big numbers rendered as note text\">\n<strong>Big numbers.<\/strong> Live totals and averages as note text rather than a chart. They follow the base's filters like any view.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/agate\/horizon-table.jpg\" alt=\"A cubism-style horizon chart: one row per market note, each with its own price series\">\n<strong>Per-note data.<\/strong> One row per note, each drawing its own time series as a cubism-style horizon chart.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/agate\/themes.jpg\" alt=\"The same board-game charts in four themes: Du Bois, FiveThirtyEight, dark Obsidian, and a hatched print style\">\n<strong>Themes.<\/strong> One spec, four looks. The theme lives apart from the spec and can follow your Obsidian theme, light or dark, as it changes.<\/div>\n\n<p>Plain Vega covers almost any picture, but a vault is not a CSV file: notes link to each other, sit in folders, and often stand for something measured elsewhere. A few extras make that available to a spec, without leaving the standard grammar \u2014 Agate's additions live under <code>usermeta<\/code>, which Vega ignores, so specs stay portable.<\/p>\n<ul>\n<li><strong>Big numbers<\/strong> \u2014 headline figures (books this year, average rating, change from last year) shown as text.<\/li>\n<li><strong>The vault as data<\/strong> \u2014 links between notes and the folder tree are available as datasets, for link graphs, arc diagrams and sunbursts.<\/li>\n<li><strong>Per-note data<\/strong> \u2014 a note can point to its own CSV, JSON or URL, e.g. a price history per stock note.<\/li>\n<li><strong>Basemaps<\/strong> \u2014 map tiles under routes and points, with API keys kept in Obsidian's secret storage.<\/li>\n<li><strong>Theme-aware<\/strong> \u2014 the default theme follows the Obsidian theme and light or dark mode.<\/li>\n<\/ul>\n<!-- TODO: add real reports from other users (forum \/ GitHub \/ Reddit) as they come in \u2014 a quote or screenshot each, with permission. -->\n\n<p>Agate was built with heavy help from AI coding agents, with one demo vault that doubles as the test suite. <!-- TODO: link to the planned \"how I built it\" post once it exists --> Feedback and examples are welcome on <a href=\"https:\/\/github.com\/Casyfill\/Agate\/issues\">GitHub<\/a>.<\/p>"},{"title":"Notes for machines, or why we adopted OKF","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/okf-notes-for-machines\/","rel":"alternate"}},"published":"2026-07-31T12:00:00-04:00","updated":"2026-07-31T12:00:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2026-07-31:\/okf-notes-for-machines\/","summary":"<p><em>Plain markdown, YAML frontmatter, and a little discipline \u2014 the cheapest way I found to make our LLM work better, cheaper, and above all faster.<\/em><\/p>\n<hr>\n<p>My team keeps a knowledge base: a couple hundred markdown notes on our products, pipelines, and decisions, cross-linked with wikilinks and published as a static site \u2026<\/p>","content":"<p><em>Plain markdown, YAML frontmatter, and a little discipline \u2014 the cheapest way I found to make our LLM work better, cheaper, and above all faster.<\/em><\/p>\n<hr>\n<p>My team keeps a knowledge base: a couple hundred markdown notes on our products, pipelines, and decisions, cross-linked with wikilinks and published as a static site. Humans read it, but lately its heaviest readers are agents. And that changes the economics. An agent that has to rediscover context \u2014 scrape a wiki, guess at table names, ask around \u2014 is slow, expensive, and prone to inventing what it can't find. An agent pointed at a curated bundle of notes just... reads them, follows the links, and gets to work.<\/p>\n<p>That is what <a href=\"https:\/\/github.com\/GoogleCloudPlatform\/knowledge-catalog\/tree\/main\/okf\">OKF<\/a> \u2014 Google's Open Knowledge Format \u2014 standardizes: knowledge as plain markdown files with YAML frontmatter, organized in a directory tree, readable by humans and agents alike, diffable in git. We conformed our KB to v0.1 this July: four required frontmatter fields, a small type taxonomy, every wikilink must resolve, all enforced by a lint gate in CI. The gains were immediate. Quality, because a note with missing frontmatter or a dead link can't merge. Cost, because plain files in git need no retrieval infrastructure, no vendor, no index to keep warm. And speed most of all \u2014 an agent starts each task from the index and arrives at the right note in a hop or two, instead of burning tokens reconstructing what the team already knows.<\/p>\n<p>v0.1 left real gaps, though. When an agent writes or edits a note, who is the author \u2014 and did a person actually check it? Is that pipeline doc still current, or quietly superseded? What is a claim derived from? We patched all of this with prose conventions: an <code>author<\/code> field, changelog entries naming the agent, deprecation banners in the body, and a human merge gate whose review left no record at all. Workable, but invisible to a machine reader \u2014 the one audience that most needs to know whether to trust a note.<\/p>\n<p><a href=\"https:\/\/cloud.google.com\/blog\/products\/data-analytics\/okf-v0-2-adds-trust-signals\">OKF v0.2<\/a> (published in late July) adds vocabulary for exactly these gaps: <code>generated: {by, at}<\/code> for machine-readable attribution, <code>verified: [{by, at}]<\/code> recording that a human actually reviewed the content, <code>status<\/code> and <code>stale_after<\/code> for lifecycle instead of banners, and structured <code>sources<\/code> for provenance. It's additive and backward-compatible \u2014 a v0.1 bundle is valid v0.2 unchanged \u2014 so we adopt it per-edit, no migration. The payoff: trust becomes queryable. A consumer can tell unverified, agent-generated, and human-reviewed notes apart from frontmatter alone.<\/p>\n<p>The next step I'm planning is metric definitions. Our metrics live in Databricks; the numbers people (and agents) quote should trace back to the note that defines them. v0.2 gives that note a shape: <code>sources<\/code> naming the tables and the job that computes the metric, <code>stale_after<\/code> forcing a periodic re-review, and \u2014 down the road \u2014 the new <em>Attested Computation<\/em> concept, which ties a sanctioned computation to an executor receipt, so a quoted number carries its own proof of how it was produced. <!-- placeholder: specifics of the DBX metrics rollout \u2014 which metrics first, where the notes live \u2014 to fill in once decided --><\/p>\n<p>A caveat, honestly held: the spec is immature. v0.2 is a draft from a single vendor, and it may shift under us. But every field we adopt is an opt-in frontmatter key that any conforming consumer must tolerate, and the format is a near-perfect match for the tools we already prefer \u2014 markdown, Obsidian, git, a static site generator. If OKF evolves, we rename some keys. If it dies, we keep a well-linted pile of markdown. I've made worse bets.<\/p>"},{"title":"This is not a pipe","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/banana-is-just-a-banana\/","rel":"alternate"}},"published":"2026-07-21T12:00:00-04:00","updated":"2026-07-21T12:00:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2026-07-21:\/banana-is-just-a-banana\/","summary":"<p><em>Twice I planned where the AI would go in my work. Twice it ended up somewhere else, and changed what was worth building.<\/em><\/p>\n<hr>\n<!-- review note: domain deliberately abstracted; no product, dataset, or figures named. -->\n\n<p>Twice I planned where an LLM would fit into my work, and twice it ended up somewhere else. I planned a model, and the AI did the \u2026<\/p>","content":"<p><em>Twice I planned where the AI would go in my work. Twice it ended up somewhere else, and changed what was worth building.<\/em><\/p>\n<hr>\n<!-- review note: domain deliberately abstracted; no product, dataset, or figures named. -->\n\n<p>Twice I planned where an LLM would fit into my work, and twice it ended up somewhere else. I planned a model, and the AI did the research instead. I planned AI in the product, and it became the builder.<\/p>\n<p>Jamshid Gharajedaghi has a line for this in <em>Systems Thinking<\/em>: \"dissolving a problem transforms it and generates a whole new set of concerns.\" Solving a major constraint does not just expose the next bottleneck in an otherwise unchanged system. The conditions of success change, and the system has to change with them.<\/p>\n<p>I keep coming back to this now that much of my work is done together with an LLM. We build tools, and we build them with a tool. The two cases below are small, but in both, the constraint I had planned around disappeared \u2014 and <mark>what replaced it was not the next item on the same list<\/mark>. Where the AI belonged changed, who knew what changed, and so did what was worth building at all.<\/p>\n<figure class=\"column\"><img src=\"\/static\/cases\/magritte-pipe.jpg\" style=\"max-width:378px;width:100%\" alt=\"Magritte's painting of a pipe, with the words Ceci n'est pas une pipe written beneath it\">\n<figcaption>Ren\u00e9 Magritte, <a href=\"https:\/\/en.wikipedia.org\/wiki\/The_Treachery_of_Images\"><em>The Treachery of Images<\/em><\/a> (1929). <em>Ceci n'est pas une pipe<\/em> \u2014 this is not a pipe. It is a picture of one. \u00a9 Ren\u00e9 Magritte estate; shown for commentary.<\/figcaption><\/figure>\n\n<h2>Just look at the buildings<\/h2>\n<div class=\"marginnote\"><img src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/7\/72\/I_Ritz_Tower%2C_New_York_City%2C_NY%2C_USA_%283%29.jpg\/960px-I_Ritz_Tower%2C_New_York_City%2C_NY%2C_USA_%283%29.jpg\" alt=\"The Ritz Tower, a setback skyscraper on Park Avenue, Manhattan.\">\n<strong>The kind of case.<\/strong> A landmark like the Ritz Tower can trade at a steep discount for reasons the data never states outright: a land lease, say, with the ground rent buried in an old filing. The market prices it in; the model can't. Photo: <a href=\"https:\/\/commons.wikimedia.org\/wiki\/User:Elisa.rolle\">Elisa.rolle<\/a>, <a href=\"https:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\">CC BY-SA 4.0<\/a>.<\/div>\n\n<p>I was reviewing a valuation model I had built a while ago and had just migrated to new infrastructure \u2014 a good moment to re-diagnose it. I already knew one weak spot: some buildings had a big, one-sided error, consistent from sale to sale \u2014 which was a signal in itself.<\/p>\n<p>So I set out to fix it as a model improvement: a rolling calibration that would estimate each building's persistent bias from its past prediction errors and correct for it, inspired by the way a Kalman filter updates its estimate as new observations arrive. I was quite proud of myself, and already thought of presenting the fix to the team.<\/p>\n<p>Before building anything, I asked the agent to investigate whether my hypothesis held up. Instead of approval, it suggested investigating those twenty or so buildings online \u2014 and so I asked it to do just that.<\/p>\n<p>Two hours and hundreds of legal documents, newspaper articles and forum posts later, I had enough evidence to file my first CS ticket. When I was done, the next day, half of those buildings turned out to be land-leased, and the other half had their own tricky legal issues.<\/p>\n<p>I had been trying to make up for missing information with another layer of modeling. But that information was not hidden in a statistical pattern; it was written down, in documents too expensive for me to read. <mark>The constraint had been my time. Once that disappeared, the model I had planned to build no longer made sense.<\/mark><\/p>\n<h2>A regex, written by the model<\/h2>\n<p>The second case went the other way.<\/p>\n<p>We needed to normalize apartment unit strings \u2014 the \"4A\" or \"PH4A\" part of an address. It looks like an easy problem, but our data has a long tail of specific cases, and the existing packages handled them badly.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/cases\/unit-parsing-flow.png\" alt=\"Diagram of one unit string, Apt. #PH4A\/B (terrace), going through clean, classify, split and read steps to exact keys PH4A and PH4B and partial keys 4A and 4B; grey boxes show the branches it did not take\">\n<strong>One unit string, split and diced.<\/strong> Blue is the path this string takes; grey is every branch it could have taken.<\/div>\n\n<p>My plan was to put AI in the product: let a model parse the strings at runtime and make sense of them. Instead, the agent wrote a plain regex package, end to end. It stayed in the workshop, and what shipped was ordinary code.<\/p>\n<p><mark>I delegated the implementation, but not the architecture.<\/mark> Three things were fixed up front: a two-function interface as the only public surface; a basic test set the agent could not change without my approval, which I checked in every commit; and ADRs \u2014 short architecture decision records \u2014 specifying the normalization rules and edge-case policies, as the contract between developers, the LLM included.<\/p>\n<p>Here the constraint was writing and maintaining many fiddly rules. Once that was cheap, the hard part moved somewhere else.<\/p>\n<h2>Who knows what<\/h2>\n<p>Constraints are one side of these stories. Knowledge is another: where it came from, and who was right when we disagreed.<\/p>\n<p>In the first case, the model contradicted my <em>method<\/em>, and it was right: my knowledge came from general experience, while it had looked at the actual buildings. In the second, it contradicted my <em>facts<\/em>, and it was wrong \u2014 for a good reason. It insisted that \"PH 4A\" and \"4A\" are different units, because in our data they are; they should have been merged and never were. <mark>The model was faithful to the data; the data was not faithful to the world.<\/mark> Like Magritte's pipe, a string in our records is a picture of an apartment, not the apartment. I overruled it, and the merge is my next task.<\/p>\n<h2>What moved<\/h2>\n<p>Each time, removing one constraint did more than reveal the next one. <mark>It changed what was worth building<\/mark>: once looking is cheap, a model can be unnecessary; once code is cheap, the questions are about data, specification and judgment. And it changed my part in the work: less writing, more choosing which problem is worth solving, where the agent's work ends, and which source of knowledge to trust.<\/p>\n<p>I don't have answers here, but I have questions:<\/p>\n<ul>\n<li><strong>What is the real constraint?<\/strong> Do we truly lack the information, or is it just too unstructured to collect \u2014 scattered across filings, newspaper articles and forum posts?<\/li>\n<li><strong>What actually needs reasoning at runtime?<\/strong> Which problems need dynamic, context-aware judgment on every call, and which are deterministic rules \u2014 regex trees, state machines \u2014 too tedious for a person to build and maintain, but not for a machine?<\/li>\n<li><strong>Whose knowledge is right?<\/strong> The patterns in the actual data, or the common sense in a person's head? Probably neither, fully.<\/li>\n<\/ul>\n<p>The line between the tool we build and the tool that helps us build it keeps getting harder to draw. I don't yet know how to draw it clearly \u2014 only that I keep needing to.<\/p>\n<hr>\n<p><strong>References<\/strong><\/p>\n<ul>\n<li>Jamshid Gharajedaghi, <em>Systems Thinking: Managing Chaos and Complexity<\/em>, 3rd ed., Morgan Kaufmann, 2011 \u2014 \u00a71.4 \"Change of the Game,\" pp. 6\u20138. His example is Ford: success at mass production moved the challenge to markets and diversity, and the strategy that won became a liability.<\/li>\n<\/ul>"},{"title":"pyCombo \u2014 wrapping a C++ community-detection algorithm for practical use","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/pycombo\/","rel":"alternate"}},"published":"2026-06-15T20:08:00-04:00","updated":"2026-06-15T20:08:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2026-06-15:\/pycombo\/","summary":"<p><em>Turning a research C++ algorithm into something anyone can <code>pip install<\/code> \u2014 and what a decade of maintaining it taught me about shipping software that lasts.<\/em><\/p>\n<hr>\n<p>A decade ago, in grad school, the analysis in my notebook had a hole in the middle of it. To run the community-detection algorithm I \u2026<\/p>","content":"<p><em>Turning a research C++ algorithm into something anyone can <code>pip install<\/code> \u2014 and what a decade of maintaining it taught me about shipping software that lasts.<\/em><\/p>\n<hr>\n<p>A decade ago, in grad school, the analysis in my notebook had a hole in the middle of it. To run the community-detection algorithm I leaned on \u2014 Combo \u2014 I couldn't just call a function. I had to stop, write my graph out to a text file in exactly the right format, drop into a shell to run a compiled C++ binary, then read its output file back into the notebook to keep going. Every run broke the train of thought, and the notebook's tidy narrative with it. The algorithm worked fine. Living with it, in the middle of real work, did not.<\/p>\n<p>That friction is why <code>pycombo<\/code> exists \u2014 at first only to get Combo out of the shell and behind a single function call, so I never had to leave the notebook. The bigger problem came into focus later: the compiled binary I'd been handed ran on my Mac and nowhere else. Closing <em>that<\/em> gap \u2014 from <em>works on my machine<\/em> to <em><code>pip install pycombo<\/code> on a stranger's laptop<\/em> \u2014 turned out to be the real project, and I've rebuilt it three times to get there, as much because Python's packaging tools kept shifting underneath me as because I kept getting better at this. Almost none of that work was about the algorithm. It was about the build \u2014 which is exactly the part that decides whether a good algorithm ever makes it into someone else's work.<\/p>\n<h2>What Combo is, and why it's worth the trouble<\/h2>\n<p>Combo works on networks, and it detects <em>communities<\/em> \u2014 partitioning a graph into groups that are more densely connected within than between, the network analogue of clustering. The usual way to score a partition is <strong>modularity<\/strong> (Q): how much denser the within-group edges are than you'd expect in a random graph with the same degrees.<\/p>\n<div class=\"marginnote\">\n\\[ Q = \\sum_{c}\\left[\\frac{L_c}{m}-\\left(\\frac{k_c}{2m}\\right)^2\\right] \\]\nModularity \\(Q\\): \\(L_c\\) = edges inside community \\(c\\), \\(k_c\\) = total degree of its nodes, \\(m\\) = total edges \u2014 the share of edges inside communities, minus what chance predicts.\n<\/div>\n\n<p>Most methods, Combo included, then search the vast space of possible partitions for the one that maximizes Q. That space is enormous and riddled with local optima, so <em>how<\/em> you search matters enormously.<\/p>\n<p>Combo (<a href=\"https:\/\/arxiv.org\/abs\/1308.3508\">Sobolevsky, Campari, Belyi &amp; Ratti, <em>Phys. Rev. E<\/em> <strong>90<\/strong>, 012811, 2014<\/a>, out of MIT's Senseable City Lab) is a quality-first optimizer by design: maximizing modularity, it reliably finds <strong>higher-scoring partitions<\/strong> than the standard greedy and non-greedy alternatives, and on description length it's on par with Infomap.<\/p>\n<div class=\"marginnote\"><img src=\"https:\/\/senseable.mit.edu\/community_detection\/img\/portugal_img.png\" alt=\"Communities detected across Portugal from network data\">Community detection in the wild: regions of Portugal recovered from network structure. <a href=\"https:\/\/senseable.mit.edu\/community_detection\/\">MIT Senseable City Lab<\/a>.<\/div>\n\n<p>What makes it different is a richer <em>move set<\/em>: where methods like <em>Louvain<\/em> reassign one node at a time \u2014 fast, but easily trapped in local optima \u2014 Combo also merges whole communities, splits them, and shifts blocks of nodes between them, more global moves that climb out of those traps at the cost of speed. It's built for the <em>best<\/em> partition, not the <em>fastest<\/em>.<\/p>\n<p>Where it sits today: <strong>Leiden<\/strong> (2019) is the fast Louvain successor that guarantees well-connected communities, and <strong>stochastic block models<\/strong> (e.g. <code>graph-tool<\/code>) are the principled generative alternative that sidesteps modularity's <em>resolution limit<\/em>. Combo's niche is quality-first maximization on networks up to ~10\u2074 nodes \u2014 and it's objective-agnostic: hand it an arbitrary score matrix and it solves a general clique-partitioning problem.<\/p>\n<h2>The algorithm was a file someone handed me<\/h2>\n<p>I was working in Stanislav Sobolevsky's lab on a string of urban-network papers, and Combo was our default tool for pulling structure out of these graphs \u2014 recovering, say, the latent districts of a city from a social-activity network (see <em><a href=\"\/social-activity-networks-st-petersburg\/\">Social Activity Networks Shaping St. Petersburg<\/a><\/em>, HICSS 2021). The way I \"had\" the algorithm, though, was literally a file: someone handed me the C++, and I ran it.<\/p>\n<p>The reference implementation behaves like a classic research artifact. You clone <a href=\"https:\/\/github.com\/Alexander-Belyi\/Combo\">Alexander Belyi's repo<\/a>, run <code>make<\/code>, and you get <code>comboCPP<\/code> \u2014 a command-line program that reads a graph from a Pajek <code>.net<\/code> file, writes the community labels to a <code>.txt<\/code>, and prints the achieved modularity to stdout.<\/p>\n<p>That's perfectly fine for a one-off. It's quietly miserable as a daily dependency. Every experiment becomes shell orchestration: serialize your graph to disk in exactly the right format, invoke a binary that must already be compiled and on your <code>PATH<\/code>, then parse a text file back into memory before you can use the result. Nothing is importable, and the binary only runs where it was compiled. For a tool you want to live inside a notebook \u2014 and, eventually, hand to someone else \u2014 it's a bad foundation. What followed was three attempts at fixing that, spread across a decade, each shaped as much by where Python's tooling stood that year as by how much I'd learned since the last.<\/p>\n<h2>Version one: wrapping the ergonomics, not the dependency<\/h2>\n<p>So the first <code>pycombo<\/code> was the naive thing, and I'll own it: a thin Python function that wrote the graph out to a temporary Pajek file, shelled out to <code>comboCPP<\/code> through <code>subprocess<\/code>, read the output file back, and parsed it into a <code>{node: community}<\/code> dictionary. An afternoon's work! It was the conda era; \"just use a virtual environment\" still felt like a new habit, and I built the thing inside one of mine without once wondering how it would run on anyone else's.<\/p>\n<p>It did the job \u2014 my notebooks got a single function call instead of a shell ritual \u2014 but it didn't actually <em>solve<\/em> anything. It just moved the mess behind a nicer-looking door. The compiled binary still had to exist on the machine. The temp files still got written and parsed. Anyone who wanted to use it first had to reproduce the C++ build I was quietly leaning on. I had wrapped the ergonomics, not the dependency.<\/p>\n<h2>Version two: compile the C++ <em>into<\/em> Python<\/h2>\n<p>The version that mattered came years later, and it showed up alongside better tools \u2014 this was around when Poetry appeared and <code>pyproject.toml<\/code> was beginning to push out <code>setup.py<\/code>. It stopped treating Combo as an external program and started treating it as a library.<\/p>\n<p>I vendored the upstream C++ as a <strong>git submodule<\/strong> at <code>src\/Combo<\/code>, so the package tracks Belyi's source exactly rather than carrying a drifting copy. Then I wrote a small <a href=\"https:\/\/github.com\/pybind\/pybind11\">pybind11<\/a> binder (<code>src\/Binder.cpp<\/code>) and let the build compile <code>Graph.cpp<\/code>, <code>Combo.cpp<\/code>, and <code>Binder.cpp<\/code> together into a single extension module, <code>pycombo._combo<\/code>.<\/p>\n<p>Concretely, the binder is a thin layer of glue. <code>Binder.cpp<\/code> includes pybind11 and the submodule's <code>Graph.h<\/code>\/<code>Combo.h<\/code>, then defines a few small functions \u2014 <code>execute<\/code>, <code>execute_from_file<\/code>, <code>execute_from_matrix<\/code> \u2014 that each build a <code>Graph<\/code>, run the <code>ComboAlgorithm<\/code>, and hand the result back as a <code>std::tuple&lt;std::vector&lt;size_t&gt;, double&gt;<\/code> (community labels plus the achieved modularity). A single <code>PYBIND11_MODULE(_combo, m)<\/code> macro registers those functions as a Python module, and including <code>pybind11\/stl.h<\/code> quietly handles the marshalling: C++ <code>std::vector<\/code>, <code>std::tuple<\/code>, and <code>std::optional<\/code> cross the boundary as Python lists, tuples, and <code>None<\/code> with no conversion code of my own.<\/p>\n<p>The build itself is just a C++ extension build, orchestrated so the user never sees it. The compiler turns <code>Binder.cpp<\/code>, <code>Graph.cpp<\/code>, and <code>Combo.cpp<\/code> into object files and <strong>links<\/strong> them into one shared library \u2014 <code>pycombo\/_combo.cpython-3XX-&lt;platform&gt;.so<\/code> (a <code>.pyd<\/code> on Windows) \u2014 which Python then imports like any other module. The pure-Python layer on top stays tiny: <code>pycombo.execute<\/code> turns a NetworkX graph into a node count and a weighted edge list, calls <code>_combo.execute(...)<\/code>, and zips the returned integer labels back onto the original node names. That's the whole seam \u2014 Python for ergonomics, compiled C++ for the work, pybind11 in between.<\/p>\n<p>This was my <strong>first real foray into writing C\/C++<\/strong>, and I want to be honest about that: pybind11 was the on-ramp that made it survivable, and I leaned heavily on the people who knew the code. I owe a genuine thank-you to <strong>Alexander Belyi<\/strong>, who wrote and maintains the C++, and to <strong>Stanislav Sobolevsky<\/strong> \u2014 both were remarkably patient with a stream of beginner questions about the algorithm and its internals.<\/p>\n<p>The payoff is that the change collapses the entire awkward middle. There's no subprocess, no temp file, no text parsing. <code>execute()<\/code> hands a graph straight into C++ memory and gets back the partition and its modularity.<\/p>\n<h2>The real work was packaging<\/h2>\n<p>Here's the lesson I didn't expect going in: <strong>writing the binding was a weekend; making it installable was the project.<\/strong><\/p>\n<p>Poetry and a small <code>build.py<\/code> drove the compilation, and GitHub Actions built <strong>wheels for Linux, macOS, and Windows<\/strong> across the supported Python versions. The payoff is the only thing the end user ever sees:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code>pip<span class=\"w\"> <\/span>install<span class=\"w\"> <\/span>pycombo\n<\/code><\/pre><\/div>\n\n<p>No compiler, no submodule, no <code>make<\/code>. That single line is the actual difference between <em>code that exists on GitHub<\/em> and <em>code a peer can drop into their environment and reproduce<\/em>. Everything upstream of it \u2014 the binder, the build script, the CI matrix \u2014 exists purely so that line works on a stranger's laptop.<\/p>\n<h2>Version three: rebuilding on standard ground (now)<\/h2>\n<p>That tidy story had a fragile foundation, and a decade is a long time in Python packaging. The Poetry-plus-<code>build.py<\/code> path was a product of its moment: <code>build.py<\/code> was an imperative script driving the compile through <code>distutils<\/code> \u2014 and <code>distutils<\/code> was deprecated and then removed from the standard library outright in Python 3.12. The Poetry lockfile had grown to thousands of lines. Wheel publishing broke more than once (Windows quirks, CI artifact changes, a hand-maintained build matrix). And the most visible gap was hardware: there were no native <strong>Apple Silicon<\/strong> wheels, so every M-series Mac silently fell back to compiling from source \u2014 exactly the friction the package exists to remove.<\/p>\n<p><a href=\"https:\/\/github.com\/Casyfill\/pyCombo\/pull\/124\">The latest stab at this project<\/a> (v0.1.10) rebuilds the foundation on what has, in the years since, become the standard toolchain for shipping a compiled Python package:<\/p>\n<ul>\n<li><strong><a href=\"https:\/\/github.com\/astral-sh\/uv\">uv<\/a><\/strong> for dependency management and fast, reproducible locking \u2014 replacing Poetry.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/scikit-build\/scikit-build-core\">scikit-build-core<\/a> + CMake<\/strong> for the compile, replacing <code>build.py<\/code>\/<code>distutils<\/code>. pybind11 stays; it's now located by CMake's <code>find_package<\/code>.<\/li>\n<li><strong><a href=\"https:\/\/github.com\/pypa\/cibuildwheel\">cibuildwheel<\/a><\/strong> in CI to produce the whole wheel matrix in one shot \u2014 Linux <code>x86_64<\/code> and <code>aarch64<\/code>, macOS <code>arm64<\/code> (Apple Silicon) and <code>x86_64<\/code>, and Windows <code>AMD64<\/code>, across CPython 3.9\u20133.13.<\/li>\n<\/ul>\n<p>The interesting part is <em>how differently it works<\/em>. The old build was a script I babysat; the new one is configuration that delegates to tools built for the job. Instead of running my own <code>build.py<\/code>, <code>pyproject.toml<\/code> now simply <strong>names a build backend<\/strong> \u2014 scikit-build-core, under the <a href=\"https:\/\/peps.python.org\/pep-0517\/\">PEP 517 standard<\/a> \u2014 and the backend hands the actual compilation to <strong>CMake<\/strong>, a real build system that already knows how to find <strong>pybind11<\/strong>, choose the right compiler on each platform, and emit the extension. <code>uv<\/code> resolves and locks the environment in a fraction of Poetry's time. <code>cibuildwheel<\/code> spins up each target platform and builds every wheel without a matrix I maintain by hand. I stopped writing build logic and started declaring intent.<\/p>\n<p>Is this a de-facto standard? Mostly \u2014 and that's the whole point. cibuildwheel is what most projects shipping compiled wheels now reach for. scikit-build-core is the standard PEP 517 backend for CMake-based extensions \u2014 it's the path pybind11's own docs point you to \u2014 with <strong>meson-python<\/strong> as the Meson-based equivalent for projects that prefer Meson. uv is the fast-rising default for locking and environments. None of it is clever; it's the boring, blessed path. Which is exactly what I want underneath a dependency: the less novel my build, the better the odds it still works, untouched, on a stranger's laptop three years from now. (I even wrote the decision down as an ADR in the repo, so the <em>next<\/em> rebuild starts from the reasoning instead of archaeology.)<\/p>\n<p>The user-visible payoff is small, and it's the entire reason for the work: <code>pip install pycombo<\/code> on an M-series Mac stops shelling out to a compiler and just drops in a prebuilt wheel. The honest trade-off is that building <em>from source<\/em> now needs a CMake toolchain, not just a compiler \u2014 but with a matching wheel for almost every platform, almost nobody builds from source at all.<\/p>\n<p>One correctness fix the rebuild folded in, too: because the wheel compiles Combo's GPL-3.0 source directly into the binary, pyCombo is a derivative work \u2014 so I realigned its own license from MIT to GPL-3.0, to match what it actually ships.<\/p>\n<h2>What using it looks like<\/h2>\n<p>The common case is one call \u2014 and because the result is just a NetworkX graph plus a label dict, plotting it is the ordinary NetworkX path:<\/p>\n<div class=\"highlight\"><pre><span><\/span><code><span class=\"kn\">import<\/span><span class=\"w\"> <\/span><span class=\"nn\">pycombo<\/span>\n<span class=\"kn\">import<\/span><span class=\"w\"> <\/span><span class=\"nn\">networkx<\/span><span class=\"w\"> <\/span><span class=\"k\">as<\/span><span class=\"w\"> <\/span><span class=\"nn\">nx<\/span>\n<span class=\"kn\">import<\/span><span class=\"w\"> <\/span><span class=\"nn\">matplotlib.pyplot<\/span><span class=\"w\"> <\/span><span class=\"k\">as<\/span><span class=\"w\"> <\/span><span class=\"nn\">plt<\/span>\n\n<span class=\"n\">G<\/span> <span class=\"o\">=<\/span> <span class=\"n\">nx<\/span><span class=\"o\">.<\/span><span class=\"n\">karate_club_graph<\/span><span class=\"p\">()<\/span>\n<span class=\"c1\"># weight=None treats the graph as unweighted \u2014 the classic karate setup<\/span>\n<span class=\"n\">partition<\/span><span class=\"p\">,<\/span> <span class=\"n\">modularity<\/span> <span class=\"o\">=<\/span> <span class=\"n\">pycombo<\/span><span class=\"o\">.<\/span><span class=\"n\">execute<\/span><span class=\"p\">(<\/span><span class=\"n\">G<\/span><span class=\"p\">,<\/span> <span class=\"n\">weight<\/span><span class=\"o\">=<\/span><span class=\"kc\">None<\/span><span class=\"p\">,<\/span> <span class=\"n\">random_seed<\/span><span class=\"o\">=<\/span><span class=\"mi\">42<\/span><span class=\"p\">)<\/span>\n\n<span class=\"nb\">print<\/span><span class=\"p\">(<\/span><span class=\"sa\">f<\/span><span class=\"s2\">&quot;modularity Q = <\/span><span class=\"si\">{<\/span><span class=\"n\">modularity<\/span><span class=\"si\">:<\/span><span class=\"s2\">.4f<\/span><span class=\"si\">}<\/span><span class=\"s2\">&quot;<\/span><span class=\"p\">)<\/span>               <span class=\"c1\"># -&gt; 0.4198<\/span>\n<span class=\"nb\">print<\/span><span class=\"p\">(<\/span><span class=\"sa\">f<\/span><span class=\"s2\">&quot;communities  = <\/span><span class=\"si\">{<\/span><span class=\"nb\">len<\/span><span class=\"p\">(<\/span><span class=\"nb\">set<\/span><span class=\"p\">(<\/span><span class=\"n\">partition<\/span><span class=\"o\">.<\/span><span class=\"n\">values<\/span><span class=\"p\">()))<\/span><span class=\"si\">}<\/span><span class=\"s2\">&quot;<\/span><span class=\"p\">)<\/span>  <span class=\"c1\"># -&gt; 4<\/span>\n\n<span class=\"c1\"># color each node by the community Combo assigned it<\/span>\n<span class=\"n\">colors<\/span> <span class=\"o\">=<\/span> <span class=\"p\">[<\/span><span class=\"n\">partition<\/span><span class=\"p\">[<\/span><span class=\"n\">n<\/span><span class=\"p\">]<\/span> <span class=\"k\">for<\/span> <span class=\"n\">n<\/span> <span class=\"ow\">in<\/span> <span class=\"n\">G<\/span><span class=\"o\">.<\/span><span class=\"n\">nodes<\/span><span class=\"p\">()]<\/span>\n<span class=\"n\">nx<\/span><span class=\"o\">.<\/span><span class=\"n\">draw_networkx<\/span><span class=\"p\">(<\/span>\n    <span class=\"n\">G<\/span><span class=\"p\">,<\/span> <span class=\"n\">pos<\/span><span class=\"o\">=<\/span><span class=\"n\">nx<\/span><span class=\"o\">.<\/span><span class=\"n\">spring_layout<\/span><span class=\"p\">(<\/span><span class=\"n\">G<\/span><span class=\"p\">,<\/span> <span class=\"n\">seed<\/span><span class=\"o\">=<\/span><span class=\"mi\">7<\/span><span class=\"p\">),<\/span>\n    <span class=\"n\">node_color<\/span><span class=\"o\">=<\/span><span class=\"n\">colors<\/span><span class=\"p\">,<\/span> <span class=\"n\">cmap<\/span><span class=\"o\">=<\/span><span class=\"s2\">&quot;tab10&quot;<\/span><span class=\"p\">,<\/span>\n    <span class=\"n\">edge_color<\/span><span class=\"o\">=<\/span><span class=\"s2\">&quot;#cccccc&quot;<\/span><span class=\"p\">,<\/span> <span class=\"n\">font_color<\/span><span class=\"o\">=<\/span><span class=\"s2\">&quot;white&quot;<\/span><span class=\"p\">,<\/span> <span class=\"n\">node_size<\/span><span class=\"o\">=<\/span><span class=\"mi\">500<\/span><span class=\"p\">,<\/span>\n<span class=\"p\">)<\/span>\n<span class=\"n\">plt<\/span><span class=\"o\">.<\/span><span class=\"n\">axis<\/span><span class=\"p\">(<\/span><span class=\"s2\">&quot;off&quot;<\/span><span class=\"p\">)<\/span>\n<span class=\"n\">plt<\/span><span class=\"o\">.<\/span><span class=\"n\">show<\/span><span class=\"p\">()<\/span>\n<\/code><\/pre><\/div>\n\n<p>Run on Zachary's karate club \u2014 the <em>Drosophila<\/em> of community detection \u2014 that finds four communities at Q \u2248 0.4198, the textbook optimum for this graph.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/pycombo\/1_karate_combo.png\" alt=\"Zachary's Karate Club, partitioned by Combo (Q = 0.4198, 4 communities)\" style=\"display:block;margin-bottom:.35rem;\">Zachary's karate club, partitioned by Combo \u2014 Q \u2248 0.4198, four communities.<\/div>\n\n<h2>What it can do beyond the one-liner<\/h2>\n<ul>\n<li><strong>Flexible input<\/strong> \u2014 NetworkX graphs, Pajek <code>.net<\/code> files, or an adjacency matrix as a NumPy array or list.<\/li>\n<li><strong>The knobs that change results<\/strong> \u2014 <code>modularity_resolution<\/code>, a cap on the number of communities (<code>max_communities<\/code>), and a <code>random_seed<\/code> so a run is actually reproducible.<\/li>\n<li><strong>Custom objectives<\/strong> \u2014 set <code>treat_as_modularity=True<\/code> and pass your own score matrix, and you're using Combo as a general <strong>clique-partitioning<\/strong> solver, not just a modularity maximizer. This is the underused superpower: the same engine optimizes whatever matrix you hand it.<\/li>\n<\/ul>\n<h2>Does the quality claim actually show up?<\/h2>\n<p>It's worth checking the headline claim rather than taking it on faith. I ran Combo, Louvain, and Leiden on the same graphs and scored every resulting partition with the <em>same<\/em> (NetworkX) modularity function \u2014 best over five runs each, on a MacBook Pro (Apple Silicon, CPython 3.10):<\/p>\n<table>\n<thead>\n<tr>\n<th>Graph<\/th>\n<th>Combo<\/th>\n<th>Louvain<\/th>\n<th>Leiden<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Karate (n = 34)<\/td>\n<td><strong>0.4198<\/strong><\/td>\n<td>0.4198<\/td>\n<td>0.4198<\/td>\n<\/tr>\n<tr>\n<td>Les Mis\u00e9rables (n = 77)<\/td>\n<td><strong>0.5667<\/strong><\/td>\n<td>0.5667<\/td>\n<td>0.5667<\/td>\n<\/tr>\n<tr>\n<td>LFR benchmark (n = 300, \u03bc = 0.45)<\/td>\n<td><strong>0.4139<\/strong><\/td>\n<td>0.3874<\/td>\n<td>0.3962<\/td>\n<\/tr>\n<tr>\n<td>LFR benchmark (n = 1,000, \u03bc = 0.45)<\/td>\n<td><strong>0.4581<\/strong><\/td>\n<td>0.4238<\/td>\n<td>0.4476<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>On the small, well-separated classics all three land on the same optimum \u2014 there the real difference is <em>consistency<\/em>: Combo and Leiden reach it on every run, while Louvain's average drifts below its best. The gap opens up on harder networks with heavy inter-community mixing (the LFR benchmarks at \u03bc = 0.45), where Combo posts the highest modularity at both sizes \u2014 on the 1,000-node graph, roughly +2% over Leiden and +8% over Louvain. That's exactly the regime Combo was built for: when you're willing to spend more compute to get a better partition.<\/p>\n<p>And it isn't only my benchmark. An independent study by <a href=\"https:\/\/arxiv.org\/abs\/2302.14698\">Aref, Mostajabdaveh &amp; Chheda (2023)<\/a> pitted eight popular heuristics against an exact integer-programming solver on 80 networks: Combo recovered the <em>exact<\/em> maximum-modularity partition more often than any other heuristic \u2014 for 55% of the networks, versus ~36% for Leiden and 19% for Louvain \u2014 and its near-optimal partitions stayed the closest to a true optimum.<\/p>\n<p>That quality isn't free: Combo is markedly slower and hungrier for memory than Louvain or Leiden, and practical only up to networks of ~10\u2074 nodes, while they scale to millions. The full timing-and-scaling comparison lives in the <a href=\"https:\/\/github.com\/Casyfill\/pyCombo\/blob\/master\/example\/benchmark.ipynb\">benchmark notebook<\/a> \u2014 the short version is: reach for Combo when partition quality is the priority and the graph is small enough; reach for Leiden when it's large. pyCombo doesn't move that ceiling \u2014 it just makes the high-quality regime painless to get to.<\/p>\n<h2>Where it's ended up<\/h2>\n<p>I started <code>pycombo<\/code> to scratch my own itch, but the part I'm proudest of is what came after. It's been installed more than 80,000 times, and it's quietly become the default way to run Combo from Python \u2014 the workhorse behind urban-structure analyses I worked on, like recovering the social fabric of <a href=\"\/social-activity-networks-st-petersburg\/\">St. Petersburg<\/a> from social-media activity, and a baseline that turns up in independent <a href=\"https:\/\/arxiv.org\/abs\/2302.14698\">community-detection benchmarks<\/a>. None of that reach came from the algorithm itself \u2014 it came from the unglamorous work of making the algorithm usable, and keeping it usable for the better part of a decade.<\/p>\n<h2>What I took away<\/h2>\n<p>A few things stuck with me, in roughly increasing order of how long it took to believe them:<\/p>\n<p><strong>Distribution is the feature.<\/strong> A great algorithm behind a manual build step is, for most people, not available at all. The wheel on PyPI did more for adoption than any cleverness in the wrapper.<\/p>\n<p><strong>Speak the ecosystem's language.<\/strong> NetworkX in, a plain dict out, one function named <code>execute<\/code>. The less the wrapper asks a user to learn, the more the underlying algorithm gets used.<\/p>\n<p><strong>Vendor upstream, don't fork it.<\/strong> A git submodule means the package tracks Belyi's real source and inherits his fixes, instead of slowly rotting as a copy that drifts from the original.<\/p>\n<p><strong>Reproducibility is an artifact, not an intention.<\/strong> A pinned, installable wheel beats a README full of build instructions every time. The goal was never \"wrap Combo\" \u2014 it was to make sure <code>pip install pycombo<\/code> keeps working a year from now, on my laptop and on a machine I'll never see.<\/p>\n<p><strong>Boring tooling is a feature.<\/strong> The third rewrite taught me what the first two didn't: a build is most valuable when it's the least original thing in the repo. Standard backend, standard wheel builder, standard lockfile \u2014 the more my packaging looks like everyone else's, the longer it keeps working without me.<\/p>\n<p>Combo was always a good algorithm \u2014 that credit belongs to Belyi and Sobolevsky. What's mine is the layer that lets anyone actually use it: the binding, the build, the wheels, and the years of keeping all three working as the ecosystem shifted underneath them. That layer is unglamorous, and it's also the whole difference between an algorithm that exists and one people can reach for. Building it well \u2014 and rebuilding it as the tools change \u2014 turns out to be its own discipline, and it's the one I'd point to.<\/p>\n<hr>\n<h2>References &amp; resources<\/h2>\n<p><strong>The algorithm<\/strong><\/p>\n<ul>\n<li>Sobolevsky, S., Campari, R., Belyi, A., &amp; Ratti, C. (2014). General optimization technique for high-quality community detection in complex networks. <em>Physical Review E<\/em>, 90(1), 012811. <a href=\"https:\/\/arxiv.org\/abs\/1308.3508\">arXiv:1308.3508<\/a><\/li>\n<li><a href=\"http:\/\/senseable.mit.edu\/community_detection\/\">MIT Senseable City Lab \u2014 Community Detection project<\/a><\/li>\n<\/ul>\n<p><strong>Code<\/strong><\/p>\n<ul>\n<li>pyCombo (this package): <a href=\"https:\/\/github.com\/Casyfill\/pyCombo\">repo<\/a>, <a href=\"https:\/\/pypi.org\/project\/pycombo\/\">PyPi page<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/Casyfill\/pyCombo\/blob\/master\/example\/benchmark.ipynb\">Benchmark notebook<\/a> \u2014 the quality and timing comparisons behind this post.<\/li>\n<li><a href=\"https:\/\/github.com\/Alexander-Belyi\/Combo\">Combo, C++ reference implementation<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/pybind\/pybind11\">pybind11<\/a><\/li>\n<\/ul>\n<p><strong>Methods it's compared to \/ alternatives<\/strong><\/p>\n<ul>\n<li>Newman, M. E. J., &amp; Girvan, M. (2004). Finding and evaluating community structure in networks. <em>Physical Review E<\/em>, 69(2), 026113. <em>(modularity)<\/em><\/li>\n<li>Blondel, V. D., Guillaume, J.-L., Lambiotte, R., &amp; Lefebvre, E. (2008). Fast unfolding of communities in large networks. <em>J. Stat. Mech.<\/em>, P10008. <em>(Louvain)<\/em><\/li>\n<li>Rosvall, M., &amp; Bergstrom, C. T. (2008). Maps of random walks on complex networks reveal community structure. <em>PNAS<\/em>, 105(4), 1118\u20131123. <em>(Infomap)<\/em><\/li>\n<li>Traag, V. A., Waltman, L., &amp; van Eck, N. J. (2019). From Louvain to Leiden: guaranteeing well-connected communities. <em><a href=\"https:\/\/www.nature.com\/articles\/s41598-019-41695-z\">Scientific Reports<\/a><\/em>, 9, 5233. <em>(Leiden)<\/em><\/li>\n<\/ul>\n<p><strong>Selected work citing or using Combo<\/strong><\/p>\n<ul>\n<li>Aref, S., Mostajabdaveh, M., &amp; Chheda, H. (2023). Heuristic Modularity Maximization Algorithms for Community Detection Rarely Return an Optimal Partition or Anything Similar. <em>ICCS 2023<\/em>. <a href=\"https:\/\/arxiv.org\/abs\/2302.14698\">arXiv:2302.14698<\/a> \u2014 an independent benchmark in which Combo recovered the exact modularity optimum most often of eight popular heuristics.<\/li>\n<li>Sobolevsky, S., &amp; Belyi, A. (2022). Graph neural network inspired algorithm for unsupervised network community detection. <em>Applied Network Science<\/em>, 7, 63. <a href=\"https:\/\/arxiv.org\/abs\/2103.02520\">arXiv:2103.02520<\/a> \u2014 benchmarks a new GNN method against Combo.<\/li>\n<li>Landsman, D., Kats, P., Nenko, A., Kudinov, S., &amp; Sobolevsky, S. (2021). <em><a href=\"https:\/\/scholarspace.manoa.hawaii.edu\/items\/9f2923ae-874a-4e24-971b-b88c72e08e8d\">Social Activity Networks Shaping St. Petersburg<\/a><\/em>. HICSS 2021 \u2014 Combo applied to recover urban structure from a social-activity network.<\/li>\n<\/ul>"},{"title":"dfSchema \u2014 a lightweight DataFrame schema enforcer","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/dataframe-schema\/","rel":"alternate"}},"published":"2022-09-25T00:20:00-04:00","updated":"2022-09-25T00:20:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2022-09-25:\/dataframe-schema\/","summary":"<p><strong>DataFrame Schema<\/strong> is a small and slim package that does only one job - it checks if a given <em>DataFrame<\/em> fits a certain list of defined expectations. It is heavily inspired by <code>jsonschema<\/code>, has only one dependency (Pydantic) and tries to be as simple and small as possible.<\/p>\n<p>In our experience \u2026<\/p>","content":"<p><strong>DataFrame Schema<\/strong> is a small and slim package that does only one job - it checks if a given <em>DataFrame<\/em> fits a certain list of defined expectations. It is heavily inspired by <code>jsonschema<\/code>, has only one dependency (Pydantic) and tries to be as simple and small as possible.<\/p>\n<p>In our experience, we found that defining a very simple, explicit, and easy-to-generate definition of what we expect to get is crucial in our day-to-day work.<\/p>\n<h2>Core Ideas<\/h2>\n<p>Compared to the alternatives, this package has a few cornerstone ideas:\n1. It is meant to be simple and easy to use, taking minimal time to set up.\n2. It puts <em>DataFrame<\/em> front and center and goes from there (read more below).\n3. It will be interchangeable and will try to read from and write to other formats (e.g. tableschema, great_expectations, etc).<\/p>\n<h2>DataFrame in the middle<\/h2>\n<p>We explicitly define \"DataFrame\" as a package-agnostic abstraction, as it (theoretically) could be a dataframe from <em>pandas<\/em>, or <em>geopandas<\/em>, or <em>dask<\/em>, or <em>ray<\/em>, or <em>Spark<\/em>, or anything else. In each case, we use the corresponding <em>flavor<\/em>, decisions, and assumptions made by that package. For example, if we check data derived from the database into pandas, we only care about the datatype defined by <em>pandas<\/em>, and let it infer datatypes as it wishes.<\/p>\n<blockquote>\n<p>Right now we only support pandas, but it should be easy to add other flavors, and it is on our roadmap.<\/p>\n<\/blockquote>\n<h2>Resources<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/StreetEasy\/dfs\">repository<\/a><\/li>\n<li><a href=\"https:\/\/pypi.org\/project\/dataframe-schema\/\">pypi page<\/a><\/li>\n<\/ul>"},{"title":"How to research cities through data?","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/cities-through-data\/","rel":"alternate"}},"published":"2022-08-29T00:00:00-04:00","updated":"2022-08-29T00:00:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2022-08-29:\/cities-through-data\/","summary":"<p><a href=\"https:\/\/www.youtube.com\/watch?v=9P0axjVtb8I\">video<\/a> \u00b7 <a href=\"https:\/\/docs.google.com\/presentation\/d\/1AgRUjqhlr7cJt8BXN2u_FymKdUk2JbrPOrwdFTtT7O4\/edit\">slides<\/a> \u00b7 <a href=\"https:\/\/yandex.ru\/promo\/q\/confarchitecture\">event<\/a><\/p>\n<p>A talk for Yandex.Q, streamed live on YouTube on August 29, 2022, for a general audience. The question I set out to answer: how do you actually study a city through data? I walked through the sources I reach for \u2014 social media traces, mobility, open municipal \u2026<\/p>","content":"<p><a href=\"https:\/\/www.youtube.com\/watch?v=9P0axjVtb8I\">video<\/a> \u00b7 <a href=\"https:\/\/docs.google.com\/presentation\/d\/1AgRUjqhlr7cJt8BXN2u_FymKdUk2JbrPOrwdFTtT7O4\/edit\">slides<\/a> \u00b7 <a href=\"https:\/\/yandex.ru\/promo\/q\/confarchitecture\">event<\/a><\/p>\n<p>A talk for Yandex.Q, streamed live on YouTube on August 29, 2022, for a general audience. The question I set out to answer: how do you actually study a city through data? I walked through the sources I reach for \u2014 social media traces, mobility, open municipal data \u2014 what each one can and can't tell you, and why reading a place through how people behave often beats reading it off a map.<\/p>\n<!-- TODO: add the specific studies \/ case studies covered in the talk -->"},{"title":"Data science for urban planners and architects","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/data-science-for-planners\/","rel":"alternate"}},"published":"2021-01-01T00:00:00-05:00","updated":"2021-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2021-01-01:\/data-science-for-planners\/","summary":"<p><a href=\"https:\/\/www.youtube.com\/watch?v=uOK_8GPEF8s\">video<\/a> \u00b7 <a href=\"https:\/\/docs.google.com\/presentation\/d\/1C4REa8XPzuK1u5fft1TpU5ZhbLYv_2P7XH1hnBMlGJU\/edit\">slides<\/a> \u00b7 <a href=\"https:\/\/github.com\/Casyfill\/yaktak_poster\">poster code<\/a><\/p>\n<p>A talk for YakTak, a Belarusian online conference, in 2021, aimed at urban planners and architects. The thread: what data science actually offers people who design cities and buildings \u2014 which questions it can answer, where it fits into a planning workflow, and what's merely hype. I \u2026<\/p>","content":"<p><a href=\"https:\/\/www.youtube.com\/watch?v=uOK_8GPEF8s\">video<\/a> \u00b7 <a href=\"https:\/\/docs.google.com\/presentation\/d\/1C4REa8XPzuK1u5fft1TpU5ZhbLYv_2P7XH1hnBMlGJU\/edit\">slides<\/a> \u00b7 <a href=\"https:\/\/github.com\/Casyfill\/yaktak_poster\">poster code<\/a><\/p>\n<p>A talk for YakTak, a Belarusian online conference, in 2021, aimed at urban planners and architects. The thread: what data science actually offers people who design cities and buildings \u2014 which questions it can answer, where it fits into a planning workflow, and what's merely hype. I also built a poster for the event.<\/p>\n<!-- TODO: add the main examples \/ case studies; note how the poster relates to the talk -->"},{"title":"Social Activity Networks Shaping St. Petersburg","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/social-activity-networks-st-petersburg\/","rel":"alternate"}},"published":"2021-01-01T00:00:00-05:00","updated":"2021-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2021-01-01:\/social-activity-networks-st-petersburg\/","summary":"<p><em>The fuller St. Petersburg study \u2014 three layers of social data, one map of how the city really divides.<\/em><\/p>\n<hr>\n<p><strong>Landsman D, Kats P, Nenko A, Kudinov S, Sobolevsky S<\/strong> \u00b7 <em>HICSS 54, 2021<\/em> \u00b7 <a href=\"https:\/\/scholarspace.manoa.hawaii.edu\/items\/9f2923ae-874a-4e24-971b-b88c72e08e8d\">Read the paper \u2192<\/a><\/p>\n<p>The longer, fuller version of the <a href=\"\/zoning-st-petersburg\/\">Procedia paper<\/a>. We added a third layer to the social-activity \u2026<\/p>","content":"<p><em>The fuller St. Petersburg study \u2014 three layers of social data, one map of how the city really divides.<\/em><\/p>\n<hr>\n<p><strong>Landsman D, Kats P, Nenko A, Kudinov S, Sobolevsky S<\/strong> \u00b7 <em>HICSS 54, 2021<\/em> \u00b7 <a href=\"https:\/\/scholarspace.manoa.hawaii.edu\/items\/9f2923ae-874a-4e24-971b-b88c72e08e8d\">Read the paper \u2192<\/a><\/p>\n<p>The longer, fuller version of the <a href=\"\/zoning-st-petersburg\/\">Procedia paper<\/a>. We added a third layer to the social-activity network: alongside geo-tagged VKontakte posts and Google Places, we brought in \"Nash Peterburg\" (\"Our Petersburg\"), the city's portal for reporting local problems \u2014 St. Petersburg's answer to 311.<\/p>\n<p>Stacking the layers and running community detection \u2014 Combo, through <a href=\"\/pycombo\/\"><code>pycombo<\/code><\/a> \u2014 on the combined network gives a zoning of the city that tracks its socioeconomic geography more faithfully than any single layer alone \u2014 the kind of read that's useful for planning, transport, and real estate. My part was the network analysis and clustering.<\/p>\n<!-- \"My part\" is inferred from author order (2nd author) and your clustering\/network focus \u2014 Philipp, please confirm or correct. -->"},{"title":"MosPlus (PlutoPlus copycat)","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/mosplus\/","rel":"alternate"}},"published":"2020-09-27T20:58:00-04:00","updated":"2020-09-27T20:58:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2020-09-27:\/mosplus\/","summary":"<p><strong>MosPlus<\/strong> is a forked version of Chris Whong's awesome <a href=\"http:\/\/chriswhong.github.io\/plutoplus\/\">PlutoPlus<\/a> project, built using open footprints for Moscow (Russia).<\/p>\n<p>Building Footprint is a great Moscow Open Data Resource that contains a wealth of information about the city's building footprints, including address, cadaster zoning, status, registration data, and few more attributes. It \u2026<\/p>","content":"<p><strong>MosPlus<\/strong> is a forked version of Chris Whong's awesome <a href=\"http:\/\/chriswhong.github.io\/plutoplus\/\">PlutoPlus<\/a> project, built using open footprints for Moscow (Russia).<\/p>\n<p>Building Footprint is a great Moscow Open Data Resource that contains a wealth of information about the city's building footprints, including address, cadaster zoning, status, registration data, and few more attributes. It contains information for the city's 145,000+ buildings, and includes 19 attributes for each one. That is (so far) a unique open data collection for Russia!<\/p>\n<p>Moscow Building Footprint is quite large, available <strong>only<\/strong> through <a href=\"http:\/\/api.data.mos.ru\/\">API<\/a> and hard to use. That is why I forked and edited blueprints for PlutoPlus, a great tool from Chris Whong (originally for <strong>MapPluto<\/strong> dataset) to help people get access to smaller chunks of the data quickly and easily for whatever they are working on.\nAll data is version from <em>25.03.2016<\/em> and can be exported as <em>geoJSON<\/em>, <em>zipped shapefile<\/em>, and <em>CSV<\/em>, or can be <em>imported directly to your cartoDB account<\/em>. Geometries are exported in <em>WGS84<\/em> (Latitude and Longitude). For neighborhood (rayon) borders, I used <a href=\"http:\/\/gis-lab.info\/qa\/moscow-atd.html\">this dataset<\/a> from Gis-Lab.<\/p>\n<blockquote>\n<p>Note: FYI, There is a separate, not-exactly-opensourced yet invaluable dataset in the wild, <strong>data for ALL Buildings in Russia<\/strong> including address, year, type, number of units and floors - so pretty similar to <em>Pluto<\/em>, originated on <em>reforma-zkh<\/em> website. It was since removed, but can be found on the internet.<\/p>\n<\/blockquote>\n<p><img alt=\"screenshot\" src=\"\/static\/mosplus.png\"><\/p>\n<h2>Links<\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/Casyfill\/mosplus\">repo<\/a><\/li>\n<li><a href=\"http:\/\/chriswhong.github.io\/plutoplus\/#\">original PlutoPlus<\/a><\/li>\n<\/ul>\n<h3>Data<\/h3>\n<ul>\n<li><a href=\"http:\/\/data.mos.ru\/opendata\/1927\/description?versionNumber=1&amp;releaseNumber=1\">Brief Description(rus)<\/a><\/li>\n<li><a href=\"http:\/\/data.mos.ru\/opendata\/1927\/passport?versionNumber=1&amp;releaseNumber=1\">Dataset Passport<\/a><\/li>\n<li><a href=\"http:\/\/data.mos.ru\/opendata\/1927\/data\/table?versionNumber=1&amp;releaseNumber=1\">Dataset<\/a><\/li>\n<\/ul>"},{"title":"A short foray in Data Journalism (2012\u20132015)","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/data-journalism\/","rel":"alternate"}},"published":"2020-05-02T00:20:00-04:00","updated":"2020-05-02T00:20:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2020-05-02:\/data-journalism\/","summary":"<p><em>Almost an accidental, formative detour into data journalism \u2014 what we built, what it taught me, and how it ended.<\/em><\/p>\n<hr>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/my_moscow.jpg\" alt=\"My movements around Moscow \u2014 a personal data-mapping experiment.\">\n<strong>My movements around Moscow.<\/strong> A personal experiment in \"quantifying thyself\" \u2014 in the spirit of my Strelka work, and of <a href=\"http:\/\/feltron.com\/\">Nicholas Felton<\/a>.<\/div>\n\n<p>In 2012, while wrapping up my year at the Strelka \u2026<\/p>","content":"<p><em>Almost an accidental, formative detour into data journalism \u2014 what we built, what it taught me, and how it ended.<\/em><\/p>\n<hr>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/my_moscow.jpg\" alt=\"My movements around Moscow \u2014 a personal data-mapping experiment.\">\n<strong>My movements around Moscow.<\/strong> A personal experiment in \"quantifying thyself\" \u2014 in the spirit of my Strelka work, and of <a href=\"http:\/\/feltron.com\/\">Nicholas Felton<\/a>.<\/div>\n\n<p>In 2012, while wrapping up my year at the Strelka Institute \u2014 where I'd taken to turning data into pictures, down to mapping a year of my own movements around the city \u2014 I got an unexpected request: to present my team's work at a small gathering at Ria Novosti, one of the country's big news agencies at the time. Their chief editor came too. As always, I was happy to present.<\/p>\n<p>It was a rare event where the stars aligned, and the audience was both genuinely interested and warm. Only later did the meaning of that presentation become clear: a few months on, just before our graduation, I received a job offer I hadn't asked for and hadn't even imagined \u2014 to continue my data-driven experiments as part of the agency's infographics department. It was completely off my radar, but after some thought, I agreed. Only later did I learn the name for what I was about to do \u2014 <em>data journalism<\/em>.<\/p>\n<p>To this day I believe this was (one of) my luckiest, most pivotal moments. I started working with fantastic people, and the work broadened my understanding of the world around me by orders of magnitude. It sounds almost funny, but a few days before I started, I was asked whether I wanted to be an <em>editor<\/em> or a <em>designer<\/em> in the team's nomenclature. To this day, I'm glad I picked <em>editing<\/em>.<\/p>\n<p>The studio was a good place to think. A small room of developers, designers, and editors on fast turnaround, building one explanatory graphic after another \u2014 which sounds like a grind and was in fact the opposite. We had room to pick our own topics, or to put our own spin on whatever was on the agenda. Every week, there was pitching. It was a proper infographics studio: people were genuinely curious, open to the world, trying to make out the bigger picture \u2014 not just the facts of the day.<\/p>\n<p>What my new boss, Maya, and I were bringing in was something new: data, not just information. Until then the work was mostly done by hand, and \"data\" usually meant a curated list of points and facts. The programmers built front-end visualizations; no real data analysis (and nothing larger than a few rows in a table, let alone \"big data\") was happening.<\/p>\n<p>And I was about to change that \u2014 except for one detail: I knew I wanted to do data analysis, but I didn't yet know how to code, at least not efficiently.<\/p>\n<h2>Duma's tax declarations<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/deputy_tax_declarations.jpeg\" alt=\"A configurator plotting each Russian deputy by income and activity, with a detail panel of one deputy's declared property.\">\n<strong>The Duma, by declaration.<\/strong> Income against activity; click a deputy for the full filing.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/duma_prototype.png\" alt=\"The same scatterplot of Russian deputies \u2014 a Grasshopper 3D prototype.\">\n<strong>Same scatterplot, Grasshopper 3D prototype.<\/strong><\/div>\n\n<p>This was one of our first big projects \u2014 essentially one giant scatterplot of every deputy. Each one files an income-and-property declaration, and almost no one reads them. They were a mess, of course: no single structure, no standards. I spent ages parsing and sifting through them, and for every car we had to attach a price tag, quantifying as much as we could. It was monumental work, and it taught me a great deal about data cleaning \u2014 and about scoping. We turned a stack that was designed to be scattered and unreadable into something you could actually explore: each official a point, income against activity, the full holdings a click away. In hindsight we could have done more with the material \u2014 but we turned plenty of heads as it was.<\/p>\n<h2>Country Budget<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/budget_calculator.jpeg\" alt=\"A Sankey-style budget calculator flowing a year of personal taxes into federal spending categories.\">\n<strong>Budget calculator.<\/strong> Your year of taxes, flowed into where the state spends it \u2014 and the country that spends most like you would.<\/div>\n\n<p>Our next big project wasn't about big data per se, but the subject was complex: the entire budget of a country. And again \u2014 this is information that isn't designed to be approachable; it's a plethora of nuance, reasoning, and history. To give it a more entertaining spin \u2014 or so we thought \u2014 we added a \"choose your own <del>adventure<\/del> budget\" game: you could change how the budget was distributed and see which country your ratios most resembled. The match was rarely what people expected. It was a good lesson: the piece was meant as a kind of edutainment \u2014 open-ended, with no critical commentary of our own \u2014 and yet every interaction nudged people toward an uncomfortable question of their own.<\/p>\n<h2>20 Years of Russian Duma<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/vis-gosduma-20.png\" alt=\"Alluvial diagram tracing the alignment of Russian parties across 20 years of the State Duma.\">\n<strong>20 years of the State Duma.<\/strong> Every party and alignment, traced across two decades. <em>Code:<\/em> Michail Dunayev \u00b7 <em>Design:<\/em> Valeriy Borisov \u00b7 <em>Editor\/analyst:<\/em> Philipp Kats \u00b7 <em>Director:<\/em> Maya Stravinskaya.<\/div>\n\n<p>Perhaps my favorite work from this era. In theory it was a small spin on our first project: again, every deputy is a colored dot \u2014 except now we traced how they moved, election to election, between parties. What began as a diverse, picturesque mix of parties settled into an anemic gathering of four large, bureaucratized ones. Yes, that's more than the two in the US \u2014 but there was no real competition. The same people kept the same seats; they wanted no change, and represented no one.<\/p>\n<p>The data processing itself was simple: parse the (very nicely built) Duma website, match names and party affiliations, double-check for surname changes, and we were done. As with so many of these, it started as a thought exercise, a small experiment \u2014 and only once we had the visualization did we realize we had a story.<\/p>\n<p>This project won us a <strong>silver medal<\/strong> at the prestigious <a href=\"https:\/\/en.wikipedia.org\/wiki\/Malofiej_Awards\">Malofiej competition<\/a> (Spain).<\/p>\n<h2>How Deputies vote<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/clusters_prototype.jpg\" alt=\"Cluster analysis of Russian deputies' votes \u2014 Gephi prototype\">\n<strong>Initial prototype.<\/strong> Almost every project began with one \u2014 not just a guide for the designer, but a base to find the story and narrative in.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/vis-gosduma-cluster.png\" alt=\"Cluster analysis of Russian deputies' votes \u2014 a dot grid showing how each deputy voted on the Dima Yakovlev law, colored by party.\">\n<strong>Politics of parties \u2014 clustering deputies by their votes.<\/strong> Each deputy is a dot; the grid shows one decisive vote. Cluster the votes and the real factions fall out of the data on their own. <em>Code:<\/em> Evgeny Panov \u00b7 <em>Design:<\/em> Alexey Novichkov, Valeriy Borisov \u00b7 <em>Editor\/analyst:<\/em> Philipp Kats \u00b7 <em>Director:<\/em> Maya Stravinskaya. <a href=\"https:\/\/ria.ru\/20130708\/948263330.html\">Original writeup<\/a> (the interactive itself is now offline).<\/div>\n\n<p>This was another piece in the \"Duma\" series \u2014 how do they actually vote? It was also me growing, technically and professionally, without quite realizing it. On the same government website I'd used before, I found an open database of the votes \u2014 every one of them, every deputy. The sobering part was that by then we had no shortage of high-profile laws to anchor attention, like the one banning American families from adopting Russian orphans \u2014 a law whose cost was concrete and countable: adoptions frozen mid-process, and, by some accounts, children who didn't survive the wait.<\/p>\n<p>But that was only the start. Using the full record for the sitting assembly, I ran what I called <em>cluster analysis<\/em> \u2014 what science would more properly call <em>community detection on networks<\/em>. I built a dense graph of all the deputies, weighted every edge by how often two of them voted the same way, and let a force layout (\"spring pull\") do the rest. In seconds, deep, hidden structures and partitions inside the party lines emerged.<\/p>\n<p>It was a real challenge: our first attempt to run the spring physics in the browser failed outright, so we fell back to precomputing the layout and animating only the transitions. I presented the project at a Network Science conference, and later heard it was being discussed in political-science circles. Looking back, I'm proud of it \u2014 I'd reinvented community detection on my own and made something people argued about. I can also see its limits now: I was rediscovering methods that already existed, without the scientific grounding or mentorship to recognize it. That gap, more than anything, is what would later point me toward graduate school.<\/p>\n<h2>Global trends challenging cities<\/h2>\n<p>This was one of the last things I made at the studio: a set of four posters for a local urban-development conference. The subject \u2014 cities \u2014 was near and dear to me, and it was a rare print commission. The project made the longlist for an Information is Beautiful award.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/muf.png\" alt=\"Global trends challenging cities \u2014 radial infographics on urbanization made for the Moscow Urban Forum.\">\n<strong>Global trends challenging cities.<\/strong> Four posters on urbanization for the Moscow Urban Forum. <em>Design:<\/em> Nadezhda Andrianova, Maria Miahaylova \u00b7 <em>Data &amp; content:<\/em> Philipp Kats. <a href=\"https:\/\/www.informationisbeautifulawards.com\/showcase\/563-global-trends-challenging-cities\">Information is Beautiful \u2014 longlist<\/a>.<\/div>\n\n<h2>How it ended, and what I took from it<\/h2>\n<p>As I hinted, some of those projects turned heads \u2014 and not everyone was happy with what the agency was doing. In late 2013 it was abruptly dissolved and folded into a new, more state-aligned holding (you may know the name: \"Russia Today\"). The brief, relatively liberal window we'd been working in was closing \u2014 the end of a somewhat liberal epoch, as we'd only understand later.<\/p>\n<p>Our team seemed to land on its feet: by mutual agreement, we moved together to Rambler &amp; Co \u2014 home of <em>Afisha<\/em> and <em>Lenta.ru<\/em>, then one of the best independent newsrooms in the country. But just weeks before we arrived, Lenta's editor-in-chief and senior staff were dismissed; much of that team regrouped abroad and founded what became <a href=\"https:\/\/meduza.io\/en\">Meduza<\/a>. We'd signed on to a very different place than the one we joined.<\/p>\n<p>In a way, I was lucky to be close to history in the making \u2014 and luckier still not to get too close. It was a short chapter, but a dense one: more than a hundred pieces in all, most ephemeral, a few I still point to \u2014 a series of stories on art and the state since the 1990s, a long-read on Stalin's legacy with the \"Memorial\" NGO, experiments piping musicians' and critics' brain activity off an \"EMOTIV EPOC\" sensor, and many, many others. That first one was a particular gift: chasing down and verifying each story sent me down a rabbit hole I happily got lost in, and introduced me to dozens of Russian artists along the way.<\/p>\n<p>I learned an enormous amount \u2014 and not only the obvious. Technical skill, yes: I bent <a href=\"https:\/\/www.grasshopper3d.com\/\">Grasshopper 3D<\/a>, meant for architectural generative design, into a makeshift data-wrangling rig, leaned on the era's toolkit \u2014 <a href=\"https:\/\/tilemill-project.github.io\/tilemill\/\">TileMill<\/a>, <a href=\"https:\/\/tabula.technology\/\">Tabula<\/a>, <a href=\"https:\/\/gephi.org\/\">Gephi<\/a>, and my beloved <a href=\"https:\/\/openrefine.org\/\">OpenRefine<\/a> \u2014 and by 2014 had taught myself Python and R. But the larger lesson was how to <em>work<\/em>: to combine creativity, experimentation, and project management, and to move fast in a small team \u2014 to compromise, to ask, to bring people along.<\/p>\n<p>And I learned where my limits were. I'd begun to feel a ceiling: I wanted to take on more than my self-taught, unmentored skills could yet carry. That, more than anything, sent me to New York in 2015, to NYU CUSP for my master's.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/data_journalism\/photo_from_police.jpg\" alt=\"Held at a police precinct after a protest, with Boris Nemtsov and Ilya Yashin \u2014 a year before Nemtsov's assassination.\">\n<strong>Held at a police precinct<\/strong>, after a protest on Manezhnaya Square \u2014 in good company with Ilya Yashin, Boris Nemtsov, and dozens of others. A year before Nemtsov's assassination.<\/div>"},{"title":"Zoning of St. Petersburg Through the Prism of Social Activity Networks","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/zoning-st-petersburg\/","rel":"alternate"}},"published":"2020-01-01T00:00:00-05:00","updated":"2020-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2020-01-01:\/zoning-st-petersburg\/","summary":"<p><em>Redrawing St. Petersburg by where people actually gather and post, rather than by its administrative borders.<\/em><\/p>\n<hr>\n<p><strong>Landsman D, Kats P, Nenko A, Sobolevsky S<\/strong> \u00b7 <em>Procedia Computer Science<\/em> 178: 125\u2013133, 2020 \u00b7 <a href=\"https:\/\/www.sciencedirect.com\/science\/article\/pii\/S1877050920323887\">Read the paper \u2192<\/a><\/p>\n<p>A St. Petersburg counterpart to the New York work, asking the same question that runs through \u2026<\/p>","content":"<p><em>Redrawing St. Petersburg by where people actually gather and post, rather than by its administrative borders.<\/em><\/p>\n<hr>\n<p><strong>Landsman D, Kats P, Nenko A, Sobolevsky S<\/strong> \u00b7 <em>Procedia Computer Science<\/em> 178: 125\u2013133, 2020 \u00b7 <a href=\"https:\/\/www.sciencedirect.com\/science\/article\/pii\/S1877050920323887\">Read the paper \u2192<\/a><\/p>\n<p>A St. Petersburg counterpart to the New York work, asking the same question that runs through all of these: can you recover a city's real structure from the digital traces people leave behind? The traces here are geo-tagged VKontakte posts and Google Places venues, which we used to build networks linking parts of the city that draw the same crowds and the same kinds of places.<\/p>\n<p>Running community detection on those networks carves the city into zones, and the zones line up with St. Petersburg's social and economic geography rather than its official map. It set up the fuller version we published the next year at <a href=\"\/social-activity-networks-st-petersburg\/\">HICSS<\/a>. My part was the network analysis and clustering.<\/p>\n<!-- \"My part\" is inferred from author order (2nd author) and your clustering\/network focus \u2014 Philipp, please confirm or correct. -->"},{"title":"Digital Urban Sensing: A Multi-layered Approach","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/digital-urban-sensing\/","rel":"alternate"}},"published":"2018-01-01T00:00:00-05:00","updated":"2018-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2018-01-01:\/digital-urban-sensing\/","summary":"<p><em>No single dataset captures a whole city \u2014 so this one asks what happens when you stack six together.<\/em><\/p>\n<hr>\n<p><strong>Zhu E, Khan M, Kats P, Bamne S, Sobolevsky S<\/strong> \u00b7 <em>arXiv preprint, 2018<\/em> \u00b7 <a href=\"https:\/\/arxiv.org\/abs\/1809.01280\">Read the paper \u2192<\/a><\/p>\n<p>The widest-angle paper of the group, and a useful check on the others. If a neighborhood's \u2026<\/p>","content":"<p><em>No single dataset captures a whole city \u2014 so this one asks what happens when you stack six together.<\/em><\/p>\n<hr>\n<p><strong>Zhu E, Khan M, Kats P, Bamne S, Sobolevsky S<\/strong> \u00b7 <em>arXiv preprint, 2018<\/em> \u00b7 <a href=\"https:\/\/arxiv.org\/abs\/1809.01280\">Read the paper \u2192<\/a><\/p>\n<p>The widest-angle paper of the group, and a useful check on the others. If a neighborhood's signature depends on Twitter, or on 311, how much does the choice of data decide what you see? We lined up six layers of New York \u2014 taxi trips, subway, Citi Bike, a mobile-app feed, Twitter, and 311 \u2014 and compared the spatial and temporal patterns each one tells on its own.<\/p>\n<p>They disagree more than you'd hope: no single source sees the whole city, and each over- or under-counts particular people and places. Combined into a multi-layered model, though, they sharpen both the zoning and the socioeconomic estimates. It stayed a preprint. My part was on the data and analysis side.<\/p>\n<!-- \"My part\" \u2014 you're 3rd author here, and of the six this is the one where your specific role is least clear to me. Please correct or expand. -->"},{"title":"Find your spot. Custom boundaries","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/find-your-spot\/","rel":"alternate"}},"published":"2018-01-01T00:00:00-05:00","updated":"2018-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2018-01-01:\/find-your-spot\/","summary":"<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1SECOPRQB4gmTur-L67Q9TGDOBC7o5o-IJVgDdb1kDek\/edit\">slides<\/a><\/p>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/se_ads_before.png\" alt=\"A StreetEasy 'Find your place' subway ad: a building in cutaway with floors labeled hint of garbage, aroma of garbage, smell of garbage.\">\n<strong>The pitch, on the street.<\/strong> StreetEasy's \"Find your place\" campaign at the time \u2014 the right apartment is the one that fits you.<\/div>\n\n<!-- TODO: video link \u2014 the previous link (Dropbox nyc_datavis_all.mp4) was incorrect and has been removed; add the correct recording once recovered -->\n\n<p>A talk at GeoNYC, New York's geospatial meetup, hosted that night by <a href=\"https:\/\/carto.com\/\">Carto<\/a>. I was about two years into StreetEasy, whose pitch then was that it helped \u2026<\/p>","content":"<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1SECOPRQB4gmTur-L67Q9TGDOBC7o5o-IJVgDdb1kDek\/edit\">slides<\/a><\/p>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/se_ads_before.png\" alt=\"A StreetEasy 'Find your place' subway ad: a building in cutaway with floors labeled hint of garbage, aroma of garbage, smell of garbage.\">\n<strong>The pitch, on the street.<\/strong> StreetEasy's \"Find your place\" campaign at the time \u2014 the right apartment is the one that fits you.<\/div>\n\n<!-- TODO: video link \u2014 the previous link (Dropbox nyc_datavis_all.mp4) was incorrect and has been removed; add the correct recording once recovered -->\n\n<p>A talk at GeoNYC, New York's geospatial meetup, hosted that night by <a href=\"https:\/\/carto.com\/\">Carto<\/a>. I was about two years into StreetEasy, whose pitch then was that it helped you find what you were <em>actually<\/em> looking for, not just scroll an endless list \u2014 search you could shape to your own sense of the city. Custom boundaries were the literal version of that: find your spot, then look only there.<\/p>\n<p>The tool itself is simple. Instead of accepting our official neighborhoods, anyone can draw their own area on the map, name it, and search inside it \u2014 one boundary or many.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/custom_boundary_tool.png\" alt=\"StreetEasy's 'Create a Custom Boundary' tool: a polygon being drawn over a Manhattan street map inside the search interface.\">\n<strong>Draw your own.<\/strong> Sketch an area, name it, and it becomes a search filter.<\/div>\n\n<p>By 2018 our users had quietly drawn about forty thousand of them. That struck me as a gift: forty thousand hand-drawn polygons recording how New Yorkers really carve up their city, and marking every place our neat neighborhood map let them down.<\/p>\n<h2>Mapping forty thousand polygons<\/h2>\n<p>It was also my excuse to solve a harder problem: how do you even draw forty thousand overlapping polygons on one map? Plot them the usual way and you get an ink-black smear. This is the quiet trouble with big-data visualization \u2014 the tools are few, the technique is fiddly, and the story is hard to compose \u2014 but it pays off, because a simple aggregate often hides the very thing you're after. The answer here was datashader, fairly new at the time, which I'll come back to.<\/p>\n<figure><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/overall.png\" alt=\"All ~40,000 custom search boundaries over New York City, rendered as a glowing density map; Manhattan blazes and the boroughs' structure emerges.\">\n<figcaption><strong>The city, drawn by its searchers.<\/strong> Every custom boundary at once. The shape of New York falls out on its own, brightest where people search the most. The two squares around Union Square are the tool's default shape (see above).<\/figcaption><\/figure>\n\n<p>Even plotted as-is, the result was breath-taking. The structure of the city emerges on its own: people fence their searches along highways and big avenues. A few mega-polygons stretch clear across the map, drawn by people searching whole boroughs at once. And one spot in Queens lit up in a way I didn't expect.<\/p>\n<figure><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/details.png\" alt=\"The density map annotated: boxes mark a large boundary reaching toward New Jersey and a bright cluster at Forest Hills, with an arrow labeling the bright lines as highways and roads.\">\n<figcaption><strong>What you're looking at.<\/strong> The bright lines are highways and roads people bound their searches by; a mega-polygon reaches toward New Jersey; and one spot in Queens, Forest Hills, stands out.<\/figcaption><\/figure>\n\n<h2>What people draw, and what they call it<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/walkable.png\" alt=\"Density map of boundaries named 'walkable,' scattered across the city as rough circular shapes.\">\n<strong>\"Walkable.\"<\/strong> Named by feel \u2014 people drew rough circles, a radius around a point.<\/div>\n\n<p>Does anyone agree with our map? Two ways to look: how far our outlines overlap what people actually draw, and what they name the places. The naming turned out to be the louder signal.<\/p>\n<!-- TODO: add an Upper West Side \/ Prospect Heights coverage-overlay slide here if you have one. -->\n\n<p>Map every boundary someone labeled \"walkable\" and you get a scatter of rough circles: people drew a radius around wherever they stood. Others name by anchor entirely, pinning an area to the one thing that matters to them.<\/p>\n<!-- <div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/prospect_park.png\" alt=\"Density map of custom boundaries drawn around Prospect Park, Brooklyn.\">\n<strong>Prospect Park.<\/strong> Boundaries drawn around the park.<\/div>\n\n\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/equinox.png\" alt=\"Density map of custom boundaries near Equinox gym locations, scattered across Manhattan.\">\n<strong>Equinox.<\/strong> One cluster per location \u2014 the chain draws its own map.<\/div> -->\n\n<p>A park, a grocery, a gym: the boundary follows the anchor. It's a blunt, honest read on what people actually optimize for when they choose where to live.<\/p>\n<h2>Forest Hills, two neighborhoods in one<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/forest_hill.png\" alt=\"Density map of custom boundaries in Forest Hills, Queens, forming two distinct clusters.\">\n<strong>Two clusters, one name.<\/strong> Forest Hills splits cleanly in the data. Color of the polygon defined by center of the polygon being below or above the railroad.<\/div>\n\n<p>Then the real disagreement: Forest Hills, in Queens. On our map it's one clean, well-defined neighborhood. In the data it splits in two \u2014 the historic Forest Hills on one side, and a newer section across the subway and the highway, long associated with the writer Sergei Dovlatov. Our customers treat them as two places; we still file them as one.<\/p>\n<figure><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/forest_hill_photo.png\" alt=\"Aerial view of Forest Hills: low-rise houses with gardens on one side, denser blocks on the other, divided by a rail line and highway corridor.\">\n<figcaption><strong>The split, from above.<\/strong> A rail line and highway cut Forest Hills apart \u2014 low houses and gardens on one side, denser blocks on the other. The map was wrong, and the people drawing on it knew it. (Apple Maps Satellite View)<\/figcaption><\/figure>\n\n<h2>Watching the market move<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/bronx.png\" alt=\"Density of custom boundaries for Bronx, over time.\">\n<strong>The map fills in.<\/strong> Custom-boundary density across the Bronx, over time.<\/div>\n\n<p>Boundaries carry a date, so you can watch the searching itself move. Played over the years, the density creeps outward, notably across the Bronx \u2014 tracing, I'd guess, the market opening up there.<\/p>\n<h2>Why it took datashader<\/h2>\n<div class=\"marginnote\"><strong>datashader.<\/strong> A Python library that renders very large datasets by rasterizing \u2014 aggregating the data into a grid of pixels and coloring each by what lands there \u2014 instead of drawing every element as its own object.<\/div>\n\n<p>Back to the tool. Matplotlib and its kin draw each shape as an object, so forty thousand polygons either crawl or collapse into a blot. <a href=\"https:\/\/datashader.org\/\">datashader<\/a> inverts that: it aggregates the data into a pixel grid and colors each cell by how much falls in it, so density itself becomes the picture \u2014 exactly what you want when the truth is in the overlap, not in any single shape.<\/p>\n<p>A note on method, in fairness: everything here came from looking \u2014 drawing, adjusting, looking again \u2014 rather than from hard metrics. That's both the charm and the limit. There's a second layer still buried in this data for anyone who quantifies it: area overlap between drawn boundaries and our neighborhoods, naming frequencies, agreement scores, and more.<\/p>\n<h2>What I took from it<\/h2>\n<div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_geo_nyc\/ads_later.jpeg\" alt=\"A StreetEasy subway ad: a stylized map of Tribeca with the line 'places where I can still say I live in Tribeca,' and 'Find your place.'\">\n<strong>A year later.<\/strong> StreetEasy's advertising leaned into personal neighborhood lines \u2014 \"places where I can still say I live in Tribeca.\"<\/div>\n\n<p>This stays one of my favorite pieces of work \u2014 a rare case where big, messy data became legible at a glance, with no summary table standing in for it. And a year on, custom-boundary search turned up as a headline feature in StreetEasy's advertising. I can't prove my analysis drove that, but the timing was close enough to enjoy.<\/p>"},{"title":"Learn Python by Building Data Science Applications","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/learn-python-data-science\/","rel":"alternate"}},"published":"2018-01-01T00:00:00-05:00","updated":"2018-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2018-01-01:\/learn-python-data-science\/","summary":"<p><em>A project-based Python textbook that grew from the high school course David and I taught.<\/em><\/p>\n<hr>\n<p><a href=\"https:\/\/www.amazon.com\/Learn-Python-Building-Science-Applications\/dp\/1789535360\">View the book \u2192<\/a> \u00b7 <a href=\"https:\/\/github.com\/PacktPublishing\/Learn-Python-by-Building-Data-Science-Applications\">code on GitHub \u2192<\/a><\/p>\n<div class=\"marginnote\"><img src=\"\/static\/book\/book.jpg\" alt=\"Cover of Learn Python by Building Data Science Applications, Packt 2018.\">\n<strong>Learn Python by Building Data Science Applications.<\/strong> Packt, 2018 \u00b7 co-authored with <a href=\"https:\/\/www.linkedin.com\/in\/dbkatz1989\/\">David Katz<\/a>.<\/div>\n\n<p>Co-authored with <strong><a href=\"https:\/\/www.linkedin.com\/in\/dbkatz1989\/\">David Katz<\/a><\/strong>. The book grew out of a Python and data course we taught \u2026<\/p>","content":"<p><em>A project-based Python textbook that grew from the high school course David and I taught.<\/em><\/p>\n<hr>\n<p><a href=\"https:\/\/www.amazon.com\/Learn-Python-Building-Science-Applications\/dp\/1789535360\">View the book \u2192<\/a> \u00b7 <a href=\"https:\/\/github.com\/PacktPublishing\/Learn-Python-by-Building-Data-Science-Applications\">code on GitHub \u2192<\/a><\/p>\n<div class=\"marginnote\"><img src=\"\/static\/book\/book.jpg\" alt=\"Cover of Learn Python by Building Data Science Applications, Packt 2018.\">\n<strong>Learn Python by Building Data Science Applications.<\/strong> Packt, 2018 \u00b7 co-authored with <a href=\"https:\/\/www.linkedin.com\/in\/dbkatz1989\/\">David Katz<\/a>.<\/div>\n\n<p>Co-authored with <strong><a href=\"https:\/\/www.linkedin.com\/in\/dbkatz1989\/\">David Katz<\/a><\/strong>. The book grew out of a Python and data course we taught together at <strong>Liceum 33 in Kazan<\/strong> around 2017 \u2014 and became a Packt title in 2018.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/book\/simulations.png\" alt=\"Simulating Animal Population. Grid of Monte Carlo simulation plots in blue and red.\">\n<strong>Simulating Animal Population with Monte Carlo.<\/strong> From the modeling chapters \u2014 many draws, one question.<\/div>\n\n<div class=\"marginnote\"><img src=\"\/static\/book\/big_data_map.png\" alt=\"Point map of NYC 311 calls by source on a black background.\">\n<strong>Years of 311 calls in NYC, by source.<\/strong> Visualizing big data on the map \u2014 a separate skill and a specialized set of tools.<\/div>\n\n<p>It walks through Python basics, NumPy and Pandas, then several real projects \u2014 not a single storyline. There is <strong>simulation<\/strong>: Monte Carlo models of animal populations. There is <strong>working with large datasets<\/strong>: years of NYC <strong>311 service requests<\/strong>, aggregated and mapped at a scale that needs its own tools. And there is a full <strong>collect \u2192 clean \u2192 visualize<\/strong> arc: <strong>scraping WWII battle pages from Wikipedia<\/strong> with Beautiful Soup, structuring the mess, and carrying it through analysis and charts. WWII was the showcase for that last skill set \u2014 relatable, rich enough to scrape, meant to combine data with meaning \u2014 not the only subject in the book.<\/p>\n<!-- <div class=\"marginnote\"><img src=\"\/static\/book\/map.png\" alt=\"Bubble map of WWII battle locations across Europe, colored and sized by campaign.\">\n<strong>WWII battles, mapped.<\/strong> One thread \u2014 scraped from Wikipedia, cleaned, and plotted.<\/div> -->\n\n<p>We picked WWII for that collecting-and-cleaning thread for the reasons above. Once you analyze it with any depth, though, the story turns dark \u2014 casualties, geography of destruction, hierarchies of campaigns. I wouldn't choose that subject for high school students again, and by extension I wouldn't anchor a beginner book on it today. The code patterns still hold; the framing was a bet I'd make differently now, especially given developments of the recent years.<\/p>"},{"title":"Declarative visualization with Vega","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/nyc-dataviz-2018\/","rel":"alternate"}},"published":"2018-01-01T00:00:00-05:00","updated":"2018-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2018-01-01:\/nyc-dataviz-2018\/","summary":"<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1kc4VsezCkqwyPURjf3Hhp8pxO1cqGmJaXmm4QmPEH7g\/edit\">slides<\/a><\/p>\n<!-- TODO: video \u2014 confirm whether a recording exists (the Dropbox nyc_datavis_all.mp4 file was previously misattributed to \"Find your spot\"); re-link once recovered -->\n\n<p>A talk at the <a href=\"https:\/\/www.meetup.com\/datavisualization\/\">NYC Data Visualization Meetup<\/a> in 2018, the group then run by Naomi B. Robbins, about one family of tools \u2014 Vega, Vega-Lite, and Altair, the Python binding for them. Vega and Vega-Lite came out of the <a href=\"https:\/\/idl.uw.edu\/\">Interactive Data Lab at the University of Washington<\/a>. It's easy \u2026<\/p>","content":"<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1kc4VsezCkqwyPURjf3Hhp8pxO1cqGmJaXmm4QmPEH7g\/edit\">slides<\/a><\/p>\n<!-- TODO: video \u2014 confirm whether a recording exists (the Dropbox nyc_datavis_all.mp4 file was previously misattributed to \"Find your spot\"); re-link once recovered -->\n\n<p>A talk at the <a href=\"https:\/\/www.meetup.com\/datavisualization\/\">NYC Data Visualization Meetup<\/a> in 2018, the group then run by Naomi B. Robbins, about one family of tools \u2014 Vega, Vega-Lite, and Altair, the Python binding for them. Vega and Vega-Lite came out of the <a href=\"https:\/\/idl.uw.edu\/\">Interactive Data Lab at the University of Washington<\/a>. It's easy to mistake them for yet another plotting library. Vega does sit on top of D3 and a few other existing pieces, but the rendering isn't the interesting part. What sets it apart is that it's <em>declarative<\/em>, in the spirit of ggplot's grammar of graphics.<\/p>\n<h2>Charts as specifications<\/h2>\n<!-- <figure><img src=\"\/static\/presentations_talks\/2018_dataviz\/diagram.png\" alt=\"Diagram of the Vega ecosystem: Python (pdvega, Altair) compiling to Vega-Lite and Vega specs, rendered by Vega.js on top of D3, surrounded by related engines, tools, and environments.\">\n<figcaption><strong>The Vega family.<\/strong> Python (pdvega, Altair) compiles to a Vega-Lite spec, then a Vega spec, then Vega.js on top of D3, with a wide ecosystem of engines, tools, and environments around it.<\/figcaption><\/figure> -->\n\n<figure>\n<img src=\"\/static\/presentations_talks\/2018_dataviz\/editor.png\" alt=\"The Vega editor: a JSON chart specification on the left, the rendered US map it produces on the right.\">\n<figcaption><strong>Spec to chart.<\/strong> The Vega Editor: a JSON specification on the left, the chart it produces on the right. You change the spec, not the pixels.<\/figcaption>\n<\/figure>\n\n<p>The idea is simple: you say what you want to see, not how to draw it. You write a specification of the chart, and an engine executes it. One can compare it to SQL \u2014 a shared specification accepted by multiple engines, each working differently under the hood. Spelled out, a spec reads almost like a letter:<\/p>\n<blockquote>\n<p>Dear chart,<\/p>\n<p>Please show me points with X on a linear scale over \"Height\" and Y on a linear scale over \"Weight,\" size on a log scale by population, and color by gender, using the dataset I'm passing you.<\/p>\n<\/blockquote>\n<p>That framing buys a clean separation of concerns, on more than one level. The spec lives outside the data, so when the data changes the chart simply re-renders. It lives outside the visuals too: a theme can be defined once, even externally, so the same chart restyles itself when you swap themes. As an analyst you stay on the meaning, and let the styling be settled once, elsewhere.<\/p>\n<!-- <div class=\"marginnote\"><img src=\"\/static\/presentations_talks\/2018_dataviz\/editor.png\" alt=\"The Vega editor: a JSON chart specification on the left, the rendered US map it produces on the right.\">\n<strong>Spec to chart.<\/strong> The Vega Editor: a JSON specification on the left, the chart it produces on the right. You change the spec, not the pixels.<\/div> -->\n\n<p>And because the thing in the middle is just a specification, a JSON file, it travels between languages and engines. That's exactly how Altair works: Python emits the spec, and the Vega engine renders it in the browser.<\/p>\n<h2>From notebook to live page<\/h2>\n<p>That portability turned out to matter well beyond a notebook. At StreetEasy I wanted one place to host embedded charts, themed consistently, where adding a new one cost almost no development, and Vega fit exactly.<\/p>\n<div class=\"marginnote\"><strong>vega-embed.<\/strong> The standard helper for dropping a Vega or Vega-Lite view into a page: give it a spec (inline or by URL) plus a theme, and it renders, export menu included.<\/div>\n\n<p>The hosting was a few small pieces. A public S3 bucket, later behind a CDN, though any static host would do. A single page that uses <a href=\"https:\/\/github.com\/vega\/vega-embed\">vega-embed<\/a> to render a spec with our house theme. And the detail that made it click: that page reads a <code>spec_path<\/code> parameter from its own URL, so one deployed page can render any specification I point it at.<\/p>\n<p>That indirection is the whole point. Publishing a chart never touches code or a deploy \u2014 I add a spec file and change a query parameter. Every chart is just a data file, so a new or broken one can't take down the page or disturb the ones already live. The theme is set once and shared, the data lives in the spec and can be swapped underneath, and the page is static, so it caches and scales for free. One page served any number of charts, and nothing was ever at risk.<\/p>\n<p>An analyst builds the chart in a notebook with Altair, and to shave off the last step I wrote a small Python helper that exported and published it in a single line, without leaving the analysis.<\/p>\n<figure><img src=\"\/static\/presentations_talks\/2018_dataviz\/schema.png\" alt=\"App scheme: a Jupyter notebook with Altair and an internal package produces specs and data, pushed to an S3 bucket, where Vega.js and Vega-Lite.js render them with an external theme.\">\n<figcaption><strong>App scheme.<\/strong> Build in a Jupyter notebook with Altair and our internal package, push the spec and data to an S3 bucket, and let Vega render it in the browser, with the theme kept separate and specs pulled in by URL.<\/figcaption><\/figure>\n\n<p>In the CMS, WordPress for us, going live was then just pasting an embed pointed at the new URL.<\/p>\n<p>What lands on the page is live: interactive, themed to the brand, with the rich interactivity that normally takes real front-end work included by default.<\/p>\n<figure><img src=\"\/static\/presentations_talks\/2018_dataviz\/use_at_streeteasy.png\" alt=\"A published StreetEasy blog post, 'Top Neighborhoods for Night Shift Workers in NYC,' with an interactive map embedded in the page.\">\n<figcaption><strong>Live on the site.<\/strong> The result in our CMS: an interactive, brand-themed StreetEasy piece, embedded straight from a spec.<\/figcaption><\/figure>\n\n<p>Years on, the bet still reads as the right one. Separating what from how, and treating the chart itself as data, is what let a small team ship interactive graphics without standing up a front-end project behind every one. It went over well on the night, too, though I pitched it wide \u2014 more a tour of a way of thinking than a hands-on session, which asked a lot of a mixed, non-technical room.<\/p>\n<h2>What changed since<\/h2>\n<p>The tools didn't stand still. Altair picked up a prefix and is now <a href=\"https:\/\/altair-viz.github.io\/\">Vega-Altair<\/a>, and the whole family sits under <a href=\"https:\/\/numfocus.org\/project\/vega\">NumFOCUS<\/a>, the nonprofit behind NumPy and pandas, as a sponsored project \u2014 about as clear a signal of staying power as open source offers. Altair is on version 6 now, several major releases past what I demoed in 2018, still built on the Vega-Lite grammar underneath.<\/p>\n<!-- TODO (June 2026): the report you uploaded (vega-viz-since-2018.md) came through empty \u2014 re-share it and I'll fold in the specific changes you want to highlight here. -->\n\n<h2>Where it went<\/h2>\n<p>My own path drifted away from this kind of work. The team I'm on moved from economics and day-to-day editorial content to a data-product team building actual features, so public-facing visualization isn't the daily craft anymore, and I miss it more than I'd expected. The app I built to serve these specs is still running. The engineering held up; the harder problem, which I underrated at the time, was getting non-technical colleagues to use the full range of what it offered. A spec is elegant to people who think in specs; for everyone else, the distance between <em>possible<\/em> and <em>actually used<\/em> turned out to be the real design work, and the part I'd take a different run at today.<\/p>\n<p>The idea itself stayed with me. In 2026 I built <a href=\"\/agate\/\">Agate<\/a>, an Obsidian plugin that draws Vega and Vega-Lite charts from notes \u2014 the same bet on specs, this time for my own vault.<\/p>"},{"title":"Twitter Connections Shaping New York City","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/twitter-connections-nyc\/","rel":"alternate"}},"published":"2018-01-01T00:00:00-05:00","updated":"2018-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2018-01-01:\/twitter-connections-nyc\/","summary":"<p><em>Mapping who mentions whom on Twitter, to see whether social ties draw the same neighborhoods that movement does.<\/em><\/p>\n<hr>\n<p><strong>Sobolevsky S, Kats P, Malinchik S, Hoffman M, Kettler B, Kontokosta C<\/strong> \u00b7 <em>HICSS 51, 2018<\/em> \u00b7 <a href=\"https:\/\/doi.org\/10.24251\/hicss.2018.127\">Read the paper \u2192<\/a><\/p>\n<p>A step past the mobility work: instead of where people go, this one looks \u2026<\/p>","content":"<p><em>Mapping who mentions whom on Twitter, to see whether social ties draw the same neighborhoods that movement does.<\/em><\/p>\n<hr>\n<p><strong>Sobolevsky S, Kats P, Malinchik S, Hoffman M, Kettler B, Kontokosta C<\/strong> \u00b7 <em>HICSS 51, 2018<\/em> \u00b7 <a href=\"https:\/\/doi.org\/10.24251\/hicss.2018.127\">Read the paper \u2192<\/a><\/p>\n<p>A step past the mobility work: instead of where people go, this one looks at who they talk to. We built a spatial network from Twitter @-mentions across New York \u2014 treating a mention as a thread of connection between two places \u2014 and ran community detection to see whether social ties alone carve the city into neighborhoods.<\/p>\n<p>They do, and the social map lines up closely with the one movement draws, which says people who are connected also tend to move alike. My part was the network construction and clustering; Stan Sobolevsky led the paper.<\/p>\n<!-- \"My part\" is inferred from author order (2nd author) and your clustering\/network focus \u2014 Philipp, please confirm or correct. -->"},{"title":"Structure of 311 service requests as a signature of urban location","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/structure-of-311-requests\/","rel":"alternate"}},"published":"2017-10-17T00:00:00-04:00","updated":"2017-10-17T00:00:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2017-10-17:\/structure-of-311-requests\/","summary":"<p><em>The mix of problems a neighborhood reports to 311 turns out to be a reliable signature of the place itself.<\/em><\/p>\n<hr>\n<p><strong>Lingjing Wang, Cheng Qian, Philipp Kats, Constantine Kontokosta, Stanislav Sobolevsky<\/strong> \u00b7 <em>PLOS ONE<\/em> 12(10): e0186314, 2017 \u00b7 <a href=\"https:\/\/journals.plos.org\/plosone\/article?id=10.1371\/journal.pone.0186314\">Read the paper \u2192<\/a><\/p>\n<p>This was a project from Stanislav Sobolevsky's group at <a href=\"https:\/\/cusp.nyu.edu\/\">CUSP<\/a>. It \u2026<\/p>","content":"<p><em>The mix of problems a neighborhood reports to 311 turns out to be a reliable signature of the place itself.<\/em><\/p>\n<hr>\n<p><strong>Lingjing Wang, Cheng Qian, Philipp Kats, Constantine Kontokosta, Stanislav Sobolevsky<\/strong> \u00b7 <em>PLOS ONE<\/em> 12(10): e0186314, 2017 \u00b7 <a href=\"https:\/\/journals.plos.org\/plosone\/article?id=10.1371\/journal.pone.0186314\">Read the paper \u2192<\/a><\/p>\n<p>This was a project from Stanislav Sobolevsky's group at <a href=\"https:\/\/cusp.nyu.edu\/\">CUSP<\/a>. It was the first piece of science I'd written in English. My work was mostly focused on the clustering. The idea is quite simple and elegant. Planning, policy, and real estate all depend on knowing the character of a particular neighborhood, and that kind of local detail is usually expensive to gather, slow to arrive, or simply missing. A census describes a place in fine detail, but only once a decade. So, to track those changes in near-real time and for free, we turn to the city's own open data \u2014 the records of 311 complaints.<\/p>\n<p>In the US, <strong>311<\/strong> is a service not unlike the famous <strong>911<\/strong>, minus the emergency: if you have noise, illegal parking, a leaking water fountain, or a pothole, you call 311. I've used it myself a few times, to report idling cars. The phone number is standardized, but the data isn't \u2014 its structure differs a little from city to city. New York alone logs more than a million of these calls a year, and each one is tagged with what the problem was and where it happened. There the data is updated daily and published through an open <a href=\"https:\/\/data.cityofnewyork.us\/Social-Services\/311-Service-Requests-from-2020-to-Present\/erm2-nwe9\">data portal<\/a>. Every complaint comes with a category, so our idea was simple: build a <em>signature<\/em> for each neighborhood from the normalized <em>proportions<\/em> of the complaints it files. That signature is \"the unique way people use 311,\" as we put it in the paper.<\/p>\n<p>With those signatures in hand, could we spot similar neighborhoods, and even \u2014 maybe \u2014 \"nowcast\" changes in a city without waiting for the next census? That's the question the paper set out to answer.<\/p>\n<h2>A signature made of complaints<\/h2>\n<div class=\"marginnote\">\n\\[ S(a)=\\left(\\frac{s(a,t)}{s(a)}\\right)_{t=1\\ldots T}, \\quad s(a)=\\sum_{t}s(a,t) \\]\n<strong>The signature, in one line.<\/strong> For a neighborhood \\(a\\), count its requests of each type \\(t\\) and divide by the total, \\(s(a)\\). That turns the place into a list of proportions across all \\(T\\) request types. Dividing by the total is the whole point: it drops how <em>loud<\/em> a place is and keeps only <em>what<\/em> it complains about.<\/div>\n\n<p>In practice it's about as simple as it sounds. The Census Bureau already carves a city into roughly two thousand small areas \u2014 <em>census tracts<\/em>, each about the size of a neighborhood. For every tract we took its 311 calls, counted them by type, and turned the counts into proportions: what share was noise, what share was heat, and so on. That list of proportions, adding up to one, is the neighborhood's signature. Then we let a clustering algorithm do the obvious thing \u2014 pull together the tracts whose signatures look alike. No map, no demographics, nothing but the complaint mix went in. In New York, four clear groups fell out.<\/p>\n<figure><img src=\"\/static\/311\/new_york.png\" alt=\"New York City: census tracts colored into four 311-complaint clusters (left) and a radar plot of those clusters' socioeconomic features (right).\">\n<figcaption><strong>New York, by its complaints.<\/strong> Left: ~2,000 census tracts sorted into four clusters from the mix of 311 requests alone \u2014 no demographics in the loop. Right: the same clusters' socioeconomic profiles \u2014 income, schooling, race, insurance \u2014 which the clustering never saw. <em>From<\/em> Wang et&nbsp;al., <em>PLOS&nbsp;ONE<\/em> 2017 (CC&nbsp;BY), Figs&nbsp;1 &amp; 5.<\/figcaption><\/figure>\n\n<p>The groups were easy to recognize on a map. One was the loud, dense core of the city \u2014 Midtown, downtown Brooklyn, and, a little oddly, the airports \u2014 where most calls were about noise. A quieter, more residential stretch of Brooklyn and Queens stood out for blocked driveways. Another group was defined by heating complaints, and another by the state of the streets.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/311\/ny_cluster_distribution.png\" alt=\"Bar chart of the share of each 311 request type within the four New York clusters.\">\n<strong>What sets them apart.<\/strong> The share of each request type within the four clusters \u2014 noise, heating, blocked driveways, and street conditions each dominate a different group. <em>Fig 2.<\/em><\/div>\n\n<h2>Checking against the census<\/h2>\n<p>Here's the part I find satisfying. We built those groups from complaints alone \u2014 not a single figure about income, education, or race ever went in. So the honest test was to bring in the census (the 2014 American Community Survey) and ask whether the groups lined up with anything real. They did, and cleanly: income, schooling, unemployment, health-insurance coverage, and racial makeup all separated between groups the algorithm had drawn while blind to every one of them. That comparison is the radar plot above.<\/p>\n<p>From there it was a short step to actually predicting things. We trained a few standard models to read a neighborhood's socioeconomic profile \u2014 and even which way its real-estate prices were heading \u2014 from the 311 signature alone. (For the prices we used Zillow's data, years before I'd end up working there.) And none of this was a New York quirk: run the same recipe on Boston and Chicago, and the same kind of structure comes back.<\/p>\n<div class=\"marginnote\"><img src=\"\/static\/311\/chicago.png\" alt=\"Chicago: census tracts in four 311-complaint clusters (left) and a radar plot of their socioeconomic features (right).\">\n<strong>Not only New York.<\/strong> Chicago, the same method: four clusters (left) with their own distinct socioeconomic profiles (right). Boston behaved much the same. <em>Figs 3 &amp; 6.<\/em><\/div>\n\n<h2>What I took from it<\/h2>\n<p>What I like most about this work is how little it needed. No new sensors, no survey budget \u2014 just the ordinary data a city already keeps, read back as a portrait of itself. That a place's everyday data can be a cheap, honest lens on it is the throughline that runs from my <a href=\"\/data-journalism\/\">data-journalism years<\/a> into CUSP. The writing, for me, was the hard part \u2014 slower and more painful than the analysis, and, looking back, some of the most useful work I've done.<\/p>\n<p>The limits are the part I keep coming back to \u2014 most of them are still open questions for me. A 311 signature only records who calls about what, so it carries the bias of who picks up the phone in the first place. Which neighborhoods stay quiet not because nothing's wrong, but because no one there trusts the line? Prices lag too \u2014 a recorded sale reflects a decision taken months earlier \u2014 so how early can a signature really catch a place beginning to turn? None of this sinks the idea; it just marks where to tread carefully. The promise was never that complaints replace the census, only that a city, watched closely, will tell you where it's changing \u2014 often early enough to do something about it.<\/p>\n<p>My one real regret is cosmetic \u2014 the figures. Those colors are loud and dated, and I'd love to recolor every one of them. The idea deserved cleaner pictures than it got.<\/p>"},{"title":"The value of Data Science Infrastructure","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/data-science-infrastructure\/","rel":"alternate"}},"published":"2017-01-01T00:00:00-05:00","updated":"2017-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2017-01-01:\/data-science-infrastructure\/","summary":"<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1OmNIuGDNARkMqPhO2SMqEzl5DBNXzoYWxVqgyjr1a0s\/edit\">slides<\/a><\/p>\n<p>A talk for CUSP students in 2017, a year after I'd finished the program and by then working at StreetEasy. My pitch: build your own small utility tools for the job in front of you, and be deliberate about what you choose to simplify. Two kinds of work earn \u2026<\/p>","content":"<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1OmNIuGDNARkMqPhO2SMqEzl5DBNXzoYWxVqgyjr1a0s\/edit\">slides<\/a><\/p>\n<p>A talk for CUSP students in 2017, a year after I'd finished the program and by then working at StreetEasy. My pitch: build your own small utility tools for the job in front of you, and be deliberate about what you choose to simplify. Two kinds of work earn the effort \u2014 what you do constantly, where shaving friction compounds, and what you do rarely, where the real cost is the cognitive load of remembering how. Smooth both; leave the rest alone.<\/p>\n<!-- TODO: add the specific tools \/ examples used to illustrate the point -->"},{"title":"Geo-Tagged Social Media Data as a Proxy for Urban Mobility","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/geotagged-urban-mobility\/","rel":"alternate"}},"published":"2017-01-01T00:00:00-05:00","updated":"2017-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2017-01-01:\/geotagged-urban-mobility\/","summary":"<p><em>A test of whether a city's geo-tagged tweets can stand in for how people actually move.<\/em><\/p>\n<hr>\n<p><strong>Qian C, Kats P, Malinchik S, Hoffman M, Kettler B, Kontokosta C, Sobolevsky S<\/strong> \u00b7 <em>Advances in Cross-Cultural Decision Making (AHFE 2017), Springer<\/em> \u00b7 <a href=\"https:\/\/link.springer.com\/chapter\/10.1007\/978-3-319-60747-4_4\">Read the paper \u2192<\/a><\/p>\n<p>Here the question is narrow and testable: can geo-tagged \u2026<\/p>","content":"<p><em>A test of whether a city's geo-tagged tweets can stand in for how people actually move.<\/em><\/p>\n<hr>\n<p><strong>Qian C, Kats P, Malinchik S, Hoffman M, Kettler B, Kontokosta C, Sobolevsky S<\/strong> \u00b7 <em>Advances in Cross-Cultural Decision Making (AHFE 2017), Springer<\/em> \u00b7 <a href=\"https:\/\/link.springer.com\/chapter\/10.1007\/978-3-319-60747-4_4\">Read the paper \u2192<\/a><\/p>\n<p>Here the question is narrow and testable: can geo-tagged Twitter stand in for how people move around New York? We built a mobility network from where people tweet and when, checked it against the ground truth of official commuting figures, and fit the usual gravity model of how flows fall off with distance.<\/p>\n<p>The Twitter network matched the official one closely \u2014 similar community structure, similar flows \u2014 and it carried something the official data lacks: a clock, the city hour by hour. My part was the network and clustering analysis, and the small web app we built to explore the flows.<\/p>\n<!-- \"My part\" is inferred from author order (2nd author) and your clustering\/visualization background \u2014 Philipp, please confirm or correct. -->"},{"title":"Twitter Activity Timeline as a Signature of Urban Neighborhood","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/twitter-neighborhood-signature\/","rel":"alternate"}},"published":"2017-01-01T00:00:00-05:00","updated":"2017-01-01T00:00:00-05:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2017-01-01:\/twitter-neighborhood-signature\/","summary":"<p><em>The daily rhythm of geo-tagged tweets turns out to be a fingerprint of what a neighborhood is for.<\/em><\/p>\n<hr>\n<p><strong>Kats P, Qian C, Kontokosta C, Sobolevsky S<\/strong> \u00b7 <em>arXiv preprint, 2017<\/em> \u00b7 <a href=\"https:\/\/arxiv.org\/abs\/1707.06122\">Read the paper \u2192<\/a><\/p>\n<p>The Twitter cousin of the <a href=\"\/structure-of-311-requests\/\">311 paper<\/a>, and the one on this list that I worked the most \u2026<\/p>","content":"<p><em>The daily rhythm of geo-tagged tweets turns out to be a fingerprint of what a neighborhood is for.<\/em><\/p>\n<hr>\n<p><strong>Kats P, Qian C, Kontokosta C, Sobolevsky S<\/strong> \u00b7 <em>arXiv preprint, 2017<\/em> \u00b7 <a href=\"https:\/\/arxiv.org\/abs\/1707.06122\">Read the paper \u2192<\/a><\/p>\n<p>The Twitter cousin of the <a href=\"\/structure-of-311-requests\/\">311 paper<\/a>, and the one on this list that I worked the most on. Instead of complaints, the raw material is the daily timeline of geo-tagged tweets across New York: how activity rises and falls through the hours and days in each small area. We turned each neighborhood's timeline into a signature and clustered on it \u2014 the same move as the 311 work \u2014 to see whether the shape of a day tells you what a place is for.<\/p>\n<p>It does, closely enough to follow a neighborhood as it changes and to estimate socioeconomic measures at a finer time scale than official statistics manage. The same activity stream also let us flag unusual events in space and time. It stayed a preprint, never pushed on to a journal.<\/p>"},{"title":"City through Foursquare","link":{"@attributes":{"href":"https:\/\/casyfill.github.io\/city-through-foursquare\/","rel":"alternate"}},"published":"2012-04-14T00:00:00-04:00","updated":"2012-04-14T00:00:00-04:00","author":{"name":"Philipp Kats"},"id":"tag:casyfill.github.io,2012-04-14:\/city-through-foursquare\/","summary":"<p><a href=\"https:\/\/www.dropbox.com\/s\/ao1bcv225u7xnzl\/2012_04_14_presentation%20foursquare.pptx?dl=0\">slides<\/a><\/p>\n<!-- TODO: re-host the deck off Dropbox and update this link -->\n\n<p>My capstone project at the Strelka Institute, presented in spring 2012. I read Moscow through Foursquare check-ins \u2014 classifying places by how people used them (home, work, parks, retail, cafes) and mapping where the city's everyday life actually clustered.<\/p>\n<p>It started as a course project, and with the tools and \u2026<\/p>","content":"<p><a href=\"https:\/\/www.dropbox.com\/s\/ao1bcv225u7xnzl\/2012_04_14_presentation%20foursquare.pptx?dl=0\">slides<\/a><\/p>\n<!-- TODO: re-host the deck off Dropbox and update this link -->\n\n<p>My capstone project at the Strelka Institute, presented in spring 2012. I read Moscow through Foursquare check-ins \u2014 classifying places by how people used them (home, work, parks, retail, cafes) and mapping where the city's everyday life actually clustered.<\/p>\n<p>It started as a course project, and with the tools and methods I've picked up since, I'd build it differently today. The questions it asked have stayed with me, though, and the images still hold up. <!-- TODO: tune this framing in your own words --><\/p>\n<p>It also opened a longer thread. The check-in work grew into 4sqStat, built with Alexander Muzychenko, and seeded the habit of reading a city through its digital traces \u2014 the approach I carried into <a href=\"\/data-journalism\/\">data journalism<\/a> and, later, graduate work.<\/p>\n<!-- TODO: add 1\u20132 images from the deck. House style: margin note for asides, one full-width figure as the centerpiece. Put images in content\/static\/foursquare\/. Example:\n<div class=\"marginnote\"><img src=\"\/static\/foursquare\/checkins_map.png\" alt=\"Foursquare check-ins across Moscow, classified by place type\">\n<strong>Moscow by check-in.<\/strong> Places classified by use; caption + credits.<\/div>\n-->"}]}