← 开源
jiegzhan

multi-class-text-classification-cnn-rnn

Classify Kaggle San Francisco Crime Description into 39 classes. Build the model with CNN, RNN (GRU and LSTM) and Word Embeddings on Tensorflow.

TutorialsML/AI fundamentalsPython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
601
Star
256
Fork
+0
本周
4
贡献者
创建于 2016-10-28 · 更新于 2026-09-24 · 今日第 16285 名
主要开发者
jiegzhanprabh-meRickyHan
README

Project: Classify Kaggle San Francisco Crime Description

Highlights

  • Multi-class text classification (sentence classification) problem.
  • Classify Kaggle San Francisco Crime Descript into 39 Category labels.
  • Hybrid TextCNN + GRU model implemented with TensorFlow 2.x Keras.

Data: Kaggle San Francisco Crime

  • Input: Descript
  • Output: Category

Examples:

Descript Category
GRAND THEFT FROM LOCKED AUTO LARCENY/THEFT
POSSESSION OF NARCOTICS PARAPHERNALIA DRUG/NARCOTIC

Setup

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Training data is included at ./data/train.csv.zip. Prediction sample data is at ./data/small_samples.csv.

Train

python3 train.py ./data/train.csv.zip ./training_config.json

Artifacts are written to ./trained_results_/:

  • saved_model/ — exported SavedModel for inference
  • best_model.keras — best validation checkpoint (primary load path for predict)
  • words_index.json — vocabulary mapping
  • labels.json — class labels
  • trained_parameters.json — hyperparameters and sequence length

Predict

python3 predict.py ./trained_results_/ ./data/small_samples.csv

Predictions are saved to ./predicted_results_/predictions_all.csv.

Reference

排名相邻
同类项目