dz-phone-value / README.md
bitsnaps's picture
DZ Phone Value static space: ONNX client-side estimator
4378390 verified
|
Raw History Blame Contribute Delete
2.66 kB
---
title: DZ Phone Value — Smartphone Price Estimator
tags:
- tabular-data
- xgboost
- onnx
- pricing
- algeria
emoji: 📱
colorFrom: indigo
colorTo: blue
sdk: static
pinned: false
---
# DZ Phone Value — Smartphone Price Estimator
**100% client-side** smartphone price estimation for the Algerian phone market (new & second-hand). The XGBoost model runs directly in your browser via ONNX WebAssembly — no backend, no API calls, no data leaves your machine.
## How it works
1. **ONNX Runtime Web** loads the 1.4 MB model via WebAssembly
2. You set phone attributes (brand, tier, storage, RAM, condition, battery, region, …)
3. Feature engineering + inference happen entirely in JavaScript — 48 features → 3 gradient-boosted ensembles (point / P10 / P90)
4. Price estimate + an **80% conformal band** appear instantly
## Model
| Metric | Value |
|--------|-------|
| MAE (time-split test) | 33,053 DZD |
| R² (price) | 0.607 |
| Median APE | 22.5% |
| Signed bias | +2.0% |
| Training rows | 8,611 |
| Features | 48 |
| Interval reference | 80.2% coverage, median width 94% |
| Model version | sp10-a2-refined |
The band is a conformalized quantile regression (CQR) interval: independently
trained P10/P90 models, cross-fitted nonconformity scores, Duan smearing after
the log-space prediction. The display clamp only ever widens the band to
contain the point estimate.
## Faithfulness to the production app
This Space runs the **same model** as the full production app
([bitsnaps.github.io/smartphone_pricing](https://bitsnaps.github.io/smartphone_pricing/)):
- `model.onnx` is converted **directly from the shipped tree dumps** of the
production engine (byte-faithful; base values baked in)
- feature engineering in `engine.js` is a 1:1 port of the production
TypeScript module
- verified by the same two gates: **two byte-exact golden cases** (frozen
clock) and **12 Python-exported parity fixtures within 0.1%** — executed
through the real ORT-web session in a real browser
## Files
- `index.html` — self-contained frontend (embedded model metadata, no build step)
- `engine.js` — feature engineering + post-processing (ported from the production app)
- `model.onnx` — XGBoost sp10 → ONNX (point / q10 / q90 outputs, shared 48-float input)
## Data
Dataset: [bitsnaps/dz-smartphone-pricing](https://huggingface.co/datasets/bitsnaps/dz-smartphone-pricing)
— cleaned marketplace listings + retail storefront reference, collected from
multiple public sources covering the Algerian phone market (sources intentionally
not attributed).
Predictions are list-price hints, **not an official valuation**.