HK-TransitFlow-Net / README.md
Antcar
Upload README.md with huggingface_hub
06bff58 verified
|
raw
history blame
1.5 kB
metadata
library_name: keras
tags:
  - transportation
  - eta-prediction
  - time-series
  - regression
  - hong-kong
  - tabular
framework: tensorflow
license: mit

HK-TransitFlow-Net

A Deep Neural Network for predicting bus travel times in Hong Kong.

Accuracy: ~64 seconds Mean Absolute Error.
Coverage: Trained on KMB and CTB routes.

Inputs

The model accepts 5 inputs. All numerical inputs should be shaped (N, 1).

  1. distance (Float): Physical distance of the segment/trip in meters.
  2. num_stops (Float): Number of stops in the trip.
  3. hour (Int): Hour of the day (0-23).
  4. day_of_week (Int): 0=Sunday, 1=Monday, ..., 6=Saturday.
  5. route_id (String): The specific GTFS Route ID (e.g., 968+1+...). If unknown, use "UNKNOWN".

Usage (Python)

import tensorflow as tf
import numpy as np
from huggingface_hub import from_pretrained_keras

# 1. Download and Load
model = from_pretrained_keras("WheelsTransit/HK-TransitFlow-Net")

# 2. Prepare Data (Example: 5km trip, 8 stops, Mon 9AM)
# Note: Strings must be passed as tf.constant with dtype=tf.string
sample = {
    'distance': np.array([[5000.0]], dtype='float32'), 
    'num_stops': np.array([[8]], dtype='float32'),
    'hour': np.array([[9]], dtype='int32'),
    'day_of_week': np.array([[1]], dtype='int32'),
    'route_id': tf.constant([["UNKNOWN"]], dtype=tf.string) 
}

# 3. Predict
prediction = model.predict(sample)
print(f"Predicted Duration: {prediction[0][0]:.2f} seconds")