NYC taxi fare

A neural network on fast-feature-transform features, served from Django.

Price a trip

The fitted pipeline

From stages_json() and stages_state(); also at /api/pipeline.

Pipelinefitted

  1. categoriesCast

    What it does

    • DOLocationID becomes utf8
    • PULocationID becomes utf8
    • pickup_hour becomes utf8
    • pickup_weekday becomes utf8

    Parameters

    types
    DOLocationID: utf8, PULocationID: utf8, pickup_hour: utf8, pickup_weekday: utf8
  2. indicesLabelEncoder

    What it does

    • DOLocationID: 255 values seen, each with an index; anything else is 0
    • PULocationID: 164 values seen, each with an index; anything else is 0
    • pickup_hour: 24 values seen, each with an index; anything else is 0
    • pickup_weekday: 7 values seen, each with an index; anything else is 0

    Parameters

    columns
    PULocationID, DOLocationID, pickup_hour, pickup_weekday
    min_count
    10
  3. distanceStandardScaler

    What it does

    • trip_distance: minus the mean 2.7080, divided by the standard deviation 3.1014

    Parameters

    columns
    trip_distance
    with_mean
    true
    with_std
    true
  4. featuresSelect

    What it does

    • keeps PULocationID, DOLocationID, pickup_hour, pickup_weekday, trip_distance

    Parameters

    columns
    PULocationID, DOLocationID, pickup_hour, pickup_weekday, trip_distance

The model

Trained on
2026-08: 1643095 trips, validated on 461913 later ones
Validation error
$1.64 mean absolute error, $2.43 root mean squared error, R² 0.964
Baseline
$2.41, $3.29 and R² 0.935 for a straight line from distance alone
Network
Embeddings of width 8 for PULocationID, DOLocationID, pickup_hour, pickup_weekday; hidden layers of 128, 64, 32 units with batch normalization and dropout 0.3; kept from epoch 47 of 62
Libraries
fast-feature-transform 0.0.3, torch 2.14.1