Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 1.63 KB

README.md

File metadata and controls

40 lines (32 loc) · 1.63 KB

Toxic Comment Classification

Tensorflow model for solving a problem specified at a Kaggle problem Toxic Comment Classification.

The pipeline assumes that there exists a data directory pointed by a RESEARCH_DATA_DIR environment variable which maintains following structure:

  • $RESEARCH_DATA_DIR
    • toxic
      • preproc
        • train (preprocessed training data in TFRecords format)
        • test (preprocessed test data in TFRecords format)
        • vocab.txt (created during preprocessing step using the corpus)
        • wiki.simple.npy (preprocessed embeddings for faster training)
      • raw (raw CSV files from Kaggle)
      • wiki.simple.bin and wiki.simple.vec (fastText pretrained embeddings)

Entities written in bold must be available before the preprocessing step.

Usage

In order to run the preprocessing invoke following command from the repository root:

> python3 -m toxic.data.prepare

Train and evaluate the module using the main module directly. You might use multiple models by specifying names with a -n option. If a model with given name exists the pipeline will further train or evaluate this model. An environment variable TF_MODELS_DIR might be defined in order to store models data in specific directory. Otherwise system-specific temporary directory will be used.

> python3 -m toxic train -n xyz
... (training logs) ...

> python3 -m toxic test -n xyz
... (evaluation report) ...