Skip to content

Development - #1

Merged
nawinds merged 16 commits into
mainfrom
development
May 26, 2026
Merged

Development#1
nawinds merged 16 commits into
mainfrom
development

Conversation

@Lukramancer

Copy link
Copy Markdown
Collaborator

No description provided.

BeganovR and others added 16 commits May 19, 2026 21:40
- Add parktrack_ml/service.py: internal APScheduler (forecasts every :00/:30,
  weather every :05, retrain daily at 02:00 UTC)
- Add parktrack_ml/weather.py: Open-Meteo integration, auto-creates
  weather_observations table on startup, 200-day backfill
- Add parktrack_ml/model.py: CustomLogisticRegression + CustomScaler (pure numpy)
- Add parktrack_ml/data_loader.py: direct DB access for bulk training data
- Add parktrack_ml/config.py: env-based configuration (DB_*, API_*)
- Add parktrack_ml/interfaces.py: predict(zone_id, predicted_for) public API
- Add parktrack_ml/forecaster.py: 24h forecasts via ThreadPoolExecutor
- Add migrations/001_weather_observations.sql
- Add docs/weather.mdx
- Remove all DB credentials and psycopg2 from config, data_loader, weather, forecaster
- weather.py: read/write via GET /weather and POST /weather/new
- data_loader.py: occupancy and zone data via GET /occupancy and GET /zones
- api_client.py: add get_cameras(), get_weather(), post_weather();
  make model_type a parameter in post_forecast()
- forecaster.py: get active zones via API, pass model_type=logistic_regression
- service.py: remove DB table setup, API_URL/API_TOKEN only
- train.py: logistic regression training, data from API
- requirements.txt: remove psycopg2, add APScheduler
- docs/weather.mdx: updated to match official ParkTrack API spec
- migrations/: removed (table managed by api-server)
Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
Large time windows (30+ days) caused ReadTimeout on the /occupancy endpoint.
Now splits the date range into 7-day chunks and deduplicates results.

Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
- Use pd.to_numeric/to_datetime with errors='coerce' in _parse_occupancy
- Filter empty chunks before concat to preserve column dtypes
- Return only expected columns to avoid schema drift from API

Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
- Replace logistic regression with LightGBM (LGBMWrapper)
- Add cyclical time encoding (sin/cos for hour, day-of-week, month)
- Add zone_id as categorical feature (per-zone pattern learning)
- Add Russian federal holidays as is_holiday feature
- Training now uses 150 days of data (vs 30) → 17k+ samples
- Temporal 80/20 train/val split with per-class precision/recall/f1
- Val accuracy: 90.9% (was 76.2% LR on train set)
- Top features: occupancy_lag_1h, zone_id, occupancy_ma_6h
- Fix per-zone chunked loading to avoid concat dtype regression
- Keep CustomLogisticRegression as fallback in model.py

Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
- README now reflects actual architecture: LightGBM, APScheduler, 28 features, 90.9% val accuracy
- Add integration snippet for docker-compose and Python package usage
- Fix Dockerfile.predict CMD: was running predict.py, now runs service.py (the actual scheduler entrypoint)
- Update .env.example to remove obsolete vars

Co-Authored-By: BeganovR <gammellgindhart@gmail.com>
@nawinds
nawinds merged commit 0dc1f45 into main May 26, 2026
7 of 9 checks passed
nawinds added a commit that referenced this pull request Jul 15, 2026
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.

3 participants