San Francisco Crime Classification Using Machine Learning - Comparing 4 Models

تفاصيل العمل

A complete machine learning project to classify crime type (39 different categories) based on real data from San Francisco with over 878,000 records (the well-known Kaggle SF Crime Classification dataset), using Python (Pandas, Scikit-learn, Matplotlib, Seaborn).

Work steps:

- Comprehensive exploratory data analysis (EDA): crime distribution by type, day, district, and geographic location (coordinate scatter maps).

- Encoding categorical variables for day, district, and crime type.

- Dimensionality reduction using PCA (reducing 4 features to 3 components while retaining 98.5% of the variance).

- Training and comparing 4 classification models: Decision Tree, Logistic Regression, SVM, and Neural Network (MLP) - before and after applying PCA, measuring accuracy and training time for each model.

- Evaluating the models on a separate test set and generating a predictions file (submission.csv) for unseen data.

Key findings:

- A real challenge: a severely imbalanced distribution across 39 classes (from 174,900 theft cases to only 6 treason cases), reflecting the complexity of real-world crime data.

- The Decision Tree model performed best with a test accuracy of ~25.8%, followed by the Neural Network at ~22.5%.

- Applying PCA notably reduced dimensionality but did not improve accuracy — an important finding on the limitations of geographic and temporal features alone in predicting crime type.

Deliverables included: a fully documented analysis notebook, 4 trained and saved models (.pkl), comparison charts, and a final predictions file.

The full code notebook is available upon request.

ملفات مرفقة

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
تاريخ الإضافة
تاريخ الإنجاز
المهارات