PolyCard
A learned cardinality estimator for intersection queries on spatial polygons, built from MLPs.
13 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 269.8K
- Operations
- 13
- Framework
- PyTorch
- Recurrent
- No
- Published
- Journal of Intelligent Information Systems 63(3):873-891 (2025)
- Cited by
- 3 (as of 27 October 2026)
- Authors
- Yuchen Ji, Daichi Amagata, Yuya Sasaki, Takahiro Hara
- Source
- GitHub: ji-yuchen/PolyCard
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m19419
- Graph hash
- 5666342eff6f3d46f2c280a8e3ab3c2acdfbd8e735a65bfe5ca9f9bf4390926c
- Skeleton hash
- 016ac85b26146f7a67f09efd5ef4ee053075101ecc5e7f02768402a5d8faf323
- Architecture hash
- b159527570490c8fc143f2e0edee4472b2a5c2ef9803801cfc746126682fb42f
- Diagram SHA-256
- 7d9933a9f5ab9aa5ec82c9839f489c51b4b57455cf23a895ef028894ef61bd67
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
PolyCard is a neural network that estimates the result size of an intersection query on spatial polygons, that is, how many polygons in a dataset intersect a given query polygon. That number, the cardinality, is what a database's query optimizer relies on to pick an efficient plan. Earlier methods were mainly histogram-based and treated each polygon as its minimal bounding rectangle, which the paper says leads to inaccurate estimates.
The obstacle to learning this directly is that a polygon is a list of vertices of variable length, which a neural network cannot take as input. PolyCard's adaptive sampling transforms every polygon to a fixed number of vertices, ten by default in the paper. It divides the polygon's bounding rectangle into four equal-sized zones and guarantees that at least one vertex is sampled in each zone the polygon intersects. The coordinates are then normalized and concatenated into a polygon vector, and a one-hot vector records which dataset is being queried. One MLP reads the polygon vector, another reads the dataset vector, and their concatenated outputs feed an output MLP that ends in a sigmoid.
Training uses the q-error as the loss function, on query polygons from a generator that down-samples to even out the cardinality distribution. On four real-world datasets the paper reports a 30% accuracy improvement over the other methods it compared. It also reports that a single estimation costs only 4 microseconds.
Key idea. PolyCard makes variable-sized polygons usable by a neural network through adaptive sampling to a fixed size, giving a learned cardinality estimator for polygon intersection queries.
- polycard
- cardinality estimation
- learned cardinality estimator
- spatial polygons
- intersection query
- query optimization
- spatial database
- polygon intersection
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@article{Ji_2025, title={PolyCard: A learned cardinality estimator for intersection queries on spatial polygons}, volume={63}, ISSN={1573-7675}, url={http://dx.doi.org/10.1007/s10844-025-00921-z}, DOI={10.1007/s10844-025-00921-z}, number={3}, journal={Journal of Intelligent Information Systems}, publisher={Springer Science and Business Media LLC}, author={Ji, Yuchen and Amagata, Daichi and Sasaki, Yuya and Hara, Takahiro}, year={2025}, month=Jan, pages={873–891} }