--- library_name: keras tags: - transportation - eta-prediction - time-series - regression - hong-kong - tabular framework: tensorflow license: mit widget: - text: "View Demo in Space" output: url: "https://huggingface.co/spaces/WheelsTransit/HK-TransitFlow-Demo" --- # 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. The published version is mapped to used with [hk-bus-crawling](https://github.com/hkbus/hk-bus-crawling) This is an open weight model, the source is not availible. This is not Wheels Atlas, nor it is trained using the same way Atlas is. ## 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 Route ID. If unknown, use `"UNKNOWN"`. ## Usage (Python) ```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")