Skip to content

Phase 2: the model (weighted vote, confidence, accuracy check) - #2

Merged
Mehulsri07 merged 7 commits into
mainfrom
phase-2-model
Oct 13, 2026
Merged

Mehulsri07 merged 7 commits into
mainfrom
phase-2-model

Conversation

@Mehulsri07

@Mehulsri07 Mehulsri07 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Phase 2 of the design: the calculation behind everything StrataVision will show. No screens use it yet, so the app looks the same as after phase 1.

What it adds

  • Drilling groups. Every soil type falls into clay, fine sand, water-bearing or hard. The driller's water-bearing tick upgrades fine sand. "Not recorded", gaps and unlinked soil names never count.
  • The vote (predictColumn). For a point, in 5 ft steps: nearby borewells that reach that height vote, closer ones count more, poor records and address-located borewells count less. Borewells at one spot share a vote and take at most 3 of the 12 seats. Layers are compared by height above sea level, not depth. Each step says the share for each group, the likeliest, a confidence (likely, rough, none) and which borewells it came from.
  • The accuracy check (checkModel). Hides each borewell in turn, with everything else at its spot, predicts it from the rest and counts how often the best guess was right, split by confidence and by distance. Also lists odd ones out: borewells that disagree with their surroundings far more than usual.
  • The soil-type list now comes with the records, because hand-added soil types are only known to the database.

On a made-up city of 500 borewells

The true ground is known, layers thin out and vanish from place to place, and 30% of borewells share a spot with another.

Share right
Guessing by height alone, ignoring the place 71%
Steps the model calls "likely" 95%
Steps the model calls "rough" 79%
Likely and rough together 92%

With 50 of the 500 logs typed in upside down, the check listed 40 of them as odd ones out, along with 7 honest ones.

More borewells gave a better score (100 vs 500).

These logs are clean and exactly placed, so real records will score lower. The constants get tuned against real records in phase 3.

Time
One column under 1 ms
200 columns (a section) about 65 ms
10,000 columns (a city map) about 2.5 s
Accuracy check on 500 borewells about 0.4 s

Corrected after review

  • Layer depths are always feet in StrataField (it converts logs written in metres when it reads them). The first version converted again for old records marked "m"; that is removed.
  • One spot with many logs could fill all 12 seats; now it gets 3.
  • The check used to let a borewell be vouched for by another at the same spot; now the whole spot is hidden.

Checks

60 TypeScript tests (new in this PR; CI now runs them), 8 Rust tests, the start-up test of the real app.

@Mehulsri07
Mehulsri07 changed the base branch from phase-1-skeleton to main October 13, 2026 19:04
…acy check, a harder made-up city

- Layer depths are always feet in StrataField; the metres conversion was wrong and is gone.
- No spot gets more than 3 of the 12 votes, so a place with many logs cannot crowd out the rest.
- The accuracy check hides everything at a borewell's spot, takes the distance step by step,
  keeps guesses it would not show out of the headline, and needs 5 borewells to call one odd.
- The made-up ground now has layers that thin out and vanish; the model must beat guessing by
  height alone, and must find most logs planted upside down.
- The map timing limit is looser on CI runners.
@Mehulsri07
Mehulsri07 merged commit e3b7086 into main Oct 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant