History

convert README.md to README.txt

Kris Yotam committed 5 months agomain

Commit 39033001 parent 76dec982 files · +82 −88Browse files

Unified · Split

2 files
  1. README.md +0 −88
  2. README.txt +82 −0
README.md+0−88
@@ -1,88 +0,0 @@
1−# Which Is Better?
2−
3−A local paired-comparison ranking tool built on the [Bradley-Terry model](https://en.wikipedia.org/wiki/Bradley%E2%80%93Terry_model). Upload a dataset of images (JSON or SQLite), rate them by choosing between random pairs, and watch rankings converge in real time. Everything runs in your browser — no server, no accounts, no tracking.
4−
5−**Live site**: [whichisbetter.dev](https://whichisbetter.dev)
6−**Write-up**: [krisyotam.com/which-is-better](https://krisyotam.com/which-is-better)
7−
8−## How it works
9−
10−You are shown two items side by side. Pick the one you prefer. The Bradley-Terry model updates both items' strength parameters using a maximum-likelihood gradient step. Pairs are selected with an exploration bias toward items with fewer comparisons, so rankings stabilize efficiently.
11−
12−A 15-second timer runs on each pair. If it expires or you pause and unpause, the pair is skipped with no score change — only committed choices affect ratings. This keeps the data clean: indecision and distraction don't pollute your rankings.
13−
14−## Features
15−
16−- **JSON and SQLite input** — upload `.json` arrays or `.db`/`.sqlite` files. For databases, pick a table, then choose which metadata fields to display during comparison.
17−- **Metadata display** — datasets can include arbitrary fields (description, date, tags, artist, etc.). Select which to show alongside images when loading.
18−- **No-image support** — items without an `imageUrl` render as blank panels. Useful for text-only comparison sets.
19−- **Local storage** — all ratings and comparison history persist in IndexedDB. Export as JSON anytime, or import a previous session to resume.
20−- **Database re-export** — if your source was a SQLite file, export the original database back with a `paired_rating` column added to your selected table. All other tables and columns are preserved with full integrity.
21−- **Light and dark mode** — light theme matches the minimal serif aesthetic of [thiswaifudoesnotexist.net](https://www.thiswaifudoesnotexist.net). Toggle in the top-right corner.
22−- **Paginated rankings** — live ranking table with 10 items per page, showing rating, win/loss record, and thumbnail.
23−
24−## Dataset format
25−
26−### JSON
27−
28−An array of objects. Only `name` is required. `imageUrl` is optional. Any extra keys become selectable metadata fields.
29−
30−```json
31−[
32− {
33− "name": "Alpine Lake",
34− "imageUrl": "https://example.com/alpine.jpg",
35− "photographer": "Ansel Adams",
36− "year": 1938
37− },
38− {
39− "name": "Desert Dunes",
40− "imageUrl": "https://example.com/desert.jpg",
41− "photographer": "Edward Weston",
42− "year": 1947
43− }
44−]
45−```
46−
47−### SQLite
48−
49−Any `.db`, `.sqlite`, or `.sqlite3` file. You choose the table, then the display fields. The first column named `id` (or the first column) is used as the item identifier for re-export.
50−
51−## The model
52−
53−The Bradley-Terry model assigns a strength parameter $\beta_i$ to each item. The probability of item $i$ beating item $j$ is:
54−
55−$$P(i > j) = \frac{e^{\beta_i}}{e^{\beta_i} + e^{\beta_j}}$$
56−
57−After each comparison where $i$ beats $j$, parameters update via gradient ascent on the log-likelihood:
58−
59−$$\beta_i \leftarrow \beta_i + \eta \cdot (1 - P(i > j))$$
60−$$\beta_j \leftarrow \beta_j - \eta \cdot P(i > j)$$
61−
62−The learning rate $\eta = 0.4$ balances responsiveness with stability. Items start at $\beta = 0$ (equal strength). Rankings are simply items sorted by $\beta$ descending.
63−
64−## Stack
65−
66−- [Next.js 16](https://nextjs.org) (App Router, Turbopack)
67−- [sql.js](https://github.com/sql-js/sql.js) for client-side SQLite
68−- [idb](https://github.com/jakearchibald/idb) for IndexedDB
69−- No backend. No dependencies beyond these three.
70−
71−## Running locally
72−
73−```bash
74−git clone https://github.com/krisyotam/whichisbetter.git
75−cd whichisbetter
76−npm install
77−npm run dev
78−```
79−
80−Open [localhost:3000](http://localhost:3000).
81−
82−## Sample dataset
83−
84−The built-in sample loads 25 AI-generated anime faces from [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net) (Gwern Branwen's StyleGAN 2 project). Click "Load sample dataset" on the home screen to try it without uploading anything.
85−
86−## License
87−
88−MIT
README.txt+82−0
@@ -0,0 +1,82 @@
1+WHICH IS BETTER?
2+
3+Local paired-comparison ranking tool built on the Bradley-Terry
4+model. Upload a dataset of images (JSON or SQLite), rate them by
5+choosing between random pairs, and watch rankings converge in real
6+time. Everything runs in your browser.
7+
8+Live site: https://whichisbetter.dev
9+Write-up: https://krisyotam.com/which-is-better
10+
11+
12+HOW IT WORKS
13+
14+Two items shown side by side. Pick the one you prefer. The
15+Bradley-Terry model updates both items' strength parameters using
16+a maximum-likelihood gradient step. Pairs are selected with an
17+exploration bias toward items with fewer comparisons, so rankings
18+stabilize efficiently.
19+
20+A 15-second timer runs on each pair. If it expires or you pause
21+and unpause, the pair is skipped with no score change. Only
22+committed choices affect ratings.
23+
24+
25+FEATURES
26+
27+ JSON and SQLite input Upload .json arrays or .db/.sqlite files.
28+ For databases, pick a table and metadata fields.
29+ Metadata display Arbitrary fields (description, date, tags, etc.)
30+ shown alongside images during comparison.
31+ No-image support Items without imageUrl render as blank panels.
32+ Local storage Ratings persist in IndexedDB. Export/import JSON.
33+ Database re-export Export original SQLite with paired_rating column added.
34+ Light and dark mode Toggle in top-right corner.
35+ Paginated rankings Live table with rating, win/loss, thumbnail.
36+
37+
38+DATASET FORMAT
39+
40+JSON: array of objects. Only "name" is required. "imageUrl" optional.
41+Any extra keys become selectable metadata fields.
42+
43+SQLite: any .db, .sqlite, or .sqlite3 file. Choose the table,
44+then display fields.
45+
46+
47+THE MODEL
48+
49+The Bradley-Terry model assigns strength beta_i to each item.
50+Probability of i beating j:
51+
52+ P(i > j) = exp(beta_i) / (exp(beta_i) + exp(beta_j))
53+
54+After i beats j, gradient ascent on log-likelihood:
55+
56+ beta_i <- beta_i + eta * (1 - P(i > j))
57+ beta_j <- beta_j - eta * P(i > j)
58+
59+Learning rate eta = 0.4. Items start at beta = 0.
60+
61+
62+STACK
63+
64+ Next.js 16 (App Router, Turbopack)
65+ sql.js (client-side SQLite)
66+ idb (IndexedDB)
67+ No backend.
68+
69+
70+RUNNING LOCALLY
71+
72+ git clone https://git.sr.ht/~krisyotam/whichisbetter.dev
73+ cd whichisbetter.dev
74+ npm install
75+ npm run dev
76+
77+Open localhost:3000.
78+
79+
80+LICENSE
81+
82+MIT