readme: ---
  language:
  - en
  widget:
  - text: theft 3
  - text: forgery
  - text: unlawful possession short-barreled shotgun
  - text: criminal trespass 2nd degree
  - text: eluding a police vehicle
  - text: upcs synthetic narcotic
  license: apache-2.0
  ---
  
  # ROTA
  ## Rapid Offense Text Autocoder
  
  [![HuggingFace Models](https://img.shields.io/badge/%F0%9F%A4%97%20models-2021.05.18.15-blue)](https://huggingface.co/rti-international/rota)
  [![HuggingFace Spaces](https://img.shields.io/badge/%F0%9F%A4%97%20spaces-2021.05.18.15-blue)](https://huggingface.co/spaces/rti-international/rota-app)
  [![GitHub Model Release](https://img.shields.io/github/v/release/RTIInternational/rota?logo=github)](https://github.com/RTIInternational/rota)
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4770492.svg)](https://doi.org/10.5281/zenodo.4770492)
  
  ROTA Application hosted on Hugging Face Spaces: https://huggingface.co/spaces/rti-international/rota-app 
  
  Criminal justice research often requires conversion of free-text offense descriptions into overall charge categories to aid analysis. For example, the free-text offense of "eluding a police vehicle" would be coded to a charge category of "Obstruction - Law Enforcement". Since free-text offense descriptions aren't standardized and often need to be categorized in large volumes, this can result in a manual and time intensive process for researchers. ROTA is a machine learning model for converting offense text into offense codes. 
  
  Currently ROTA predicts the *Charge Category* of a given offense text. A *charge category* is one of the headings for offense codes in the [2009 NCRP Codebook: Appendix F](https://www.icpsr.umich.edu/web/NACJD/studies/30799/datadocumentation#).
  
  The model was trained on [publicly available data](https://web.archive.org/web/20201021001250/https://www.icpsr.umich.edu/web/pages/NACJD/guides/ncrp.html) from a crosswalk containing offenses from all 50 states combined with three additional hand-labeled offense text datasets.
  
  <details>
      <summary>Charge Category Example</summary>
      <img src="https://i.ibb.co/xLsrzmV/charge-category-example.png" width="500">
  </details>
  
  ### Data Preprocessing
  
  The input text is standardized through a series of preprocessing steps. The text is first passed through a sequence of 500+ case-insensitive regular expressions that identify common misspellings and abbreviations and expand the text to a more full, correct English text. Some data-specific prefixes and suffixes are then removed from the text -- e.g. some states included a statute as a part of the text. Finally, punctuation (excluding dollar signs) are removed from the input, multiple spaces between words are removed, and the text is lowercased. 
  
  ## Cross-Validation Performance
  
  This model was evaluated using 3-fold cross validation. Except where noted, numbers presented below are the mean value across the 3 folds. 
  
  The model in this repository is trained on all available data. Because of this, you can typically expect production performance to be (unknowably) better than the numbers presented below.
  
  ### Overall Metrics
  
  | Metric   | Value |
  | -------- | ----- |
  | Accuracy | 0.934 |
  | MCC      | 0.931 |
  
   
  
  | Metric    | precision | recall | f1-score |
  | --------- | --------- | ------ | -------- |
  | macro avg | 0.811     | 0.786  | 0.794    |
  
  
  *Note*: These are the average of the values *per fold*, so *macro avg* is the average of the macro average of all categories per fold.
  
  ### Per-Category Metrics
  
  | Category                                               | precision | recall | f1-score | support |
  | ------------------------------------------------------ | --------- | ------ | -------- | ------- |
  | AGGRAVATED ASSAULT                                     | 0.954     | 0.954  | 0.954    | 4085    |
  | ARMED ROBBERY                                          | 0.961     | 0.955  | 0.958    | 1021    |
  | ARSON                                                  | 0.946     | 0.954  | 0.95     | 344     |
  | ASSAULTING PUBLIC OFFICER                              | 0.914     | 0.905  | 0.909    | 588     |
  | AUTO THEFT                                             | 0.962     | 0.962  | 0.962    | 1660    |
  | BLACKMAIL/EXTORTION/INTIMIDATION                       | 0.872     | 0.871  | 0.872    | 627     |
  | BRIBERY AND CONFLICT OF INTEREST                       | 0.784     | 0.796  | 0.79     | 216     |
  | BURGLARY                                               | 0.979     | 0.981  | 0.98     | 2214    |
  | CHILD ABUSE                                            | 0.805     | 0.78   | 0.792    | 139     |
  | COCAINE OR CRACK VIOLATION OFFENSE UNSPECIFIED         | 0.827     | 0.815  | 0.821    | 47      |
  | COMMERCIALIZED VICE                                    | 0.818     | 0.788  | 0.802    | 666     |
  | CONTEMPT OF COURT                                      | 0.982     | 0.987  | 0.984    | 2952    |
  | CONTRIBUTING TO DELINQUENCY OF A MINOR                 | 0.544     | 0.333  | 0.392    | 50    