YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
GeoFare
Fare-class prediction demo. Given pickup geolocation and trip attributes,
predict whether the trip is high-fare. Trains a small Keras model on a
deterministically generated synthetic dataset (see
scripts/generate_data.py).
Pipeline contract
features.py converts raw continuous inputs into integer bin indices
and the crossed geolocation cell index; model.py consumes those indices
directly in its embedding lookups. The contract is that the feature
pipeline hands the model integer indices โ the model performs no dtype
conversion on its index inputs.
Binning conventions
- Equal-width bins (
bin_equal_width): bin k covers[lo + k*width, lo + (k+1)*width). Returns int32 indices in0..n_bins-1; out-of-range values clip to the nearest end bin. - Quantile bins (
bin_quantile): bin i covers(edges[i-1], edges[i]]โ a value exactly equal toedges[i]belongs to bin i. Returns int64 indices in0..len(edges)-1; values at or belowedges[0]go to bin 0, values aboveedges[-1]go to the last bin.
The fitted quantile edges live in features/edges.json, regenerated by the
data generator.
Usage
python scripts/generate_data.py # regenerate data/train.csv + edges (seeded)
python train.py # train; writes metrics.json
python -m pytest tests -q # unit tests
train.py writes metrics.json:
{"final_loss": ..., "num_params": ..., "embedding_delta": ...}
Configuration
See config.yaml. The deployed dtype_policy is "float64" โ intentional
and used end-to-end since 2023; do not change it without a ticket.
- Downloads last month
- 7