Skip to content

About

Data Science Prediction for the Michigan Challenge on Blight Ticket compliance

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detroit blight ticket compliance prediction in Python

A machine learning project that estimates whether a Detroit blight ticket will be paid on time. It uses pandas and scikit-learn to combine ticket records with location data, prepare features and train a gradient boosting classifier.

The project was developed for the Detroit Blight Ticket Compliance challenge.

How the model works

blightModel.py removes records without a compliance label and excludes payment-related fields that would reveal the outcome. It joins addresses and coordinates, then uses eight features: postcode, violation code, fine amount, discount amount, latitude, longitude, disposition and late fee.

Categorical encoding, mean imputation and min-max scaling prepare the inputs. A GradientBoostingClassifier uses 50 estimators, a learning rate of 0.5 and random_state=0.

flowchart TD
    A["dataFrames/: tickets, addresses and coordinates"] --> B["blight_model(): join and select features"]
    B --> C["Encode, impute and scale"]
    C --> D["Train gradient boosting classifier"]
    D --> E["Validation ROC AUC"]
    D --> F["Compliance probabilities by ticket_id"]
Loading

Running the original code

The project uses Python, pandas, NumPy and scikit-learn. Its original dependency versions are not recorded.

Two compatibility details need attention before running:

  • The code imports the legacy sklearn.preprocessing.Imputer. This requires an older compatible environment or a code update to SimpleImputer; see the scikit-learn deprecation note.
  • The CSV files are stored in dataFrames/, while the script reads dataframes/. On a case-sensitive filesystem, make that path available locally or adjust the four CSV paths.

Once those are resolved, run from the repository root:

python main.py

The script prints the validation ROC AUC. To keep the predictions, call the function directly:

from blightModel import blight_model

predictions = blight_model()
print(predictions.head())

It returns a pandas Series named compliance, indexed by ticket_id. The included main.py does not save a submission file.

Recorded results and limitations

The original project reported a local ROC AUC of 0.8147 and a university autograder AUC of 0.776. These are historical results.

Preprocessing needs further work: imputation is fitted before the validation split, and encoders and imputers are fitted separately on training and submission data. A future revision should fit preprocessing on the training split and reuse it consistently.

Licence

MIT.

About

Data Science Prediction for the Michigan Challenge on Blight Ticket compliance

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages