--- dataset_info: features: - name: id dtype: int64 - name: name dtype: string - name: first dtype: string - name: last dtype: string - name: compas_screening_date dtype: date32 - name: sex dtype: class_label: names: '0': Female '1': Male - name: dob dtype: date32 - name: age dtype: int64 - name: age_cat dtype: class_label: names: '0': 25 - 45 '1': Greater than 45 '2': Less than 25 - name: race dtype: class_label: names: '0': African-American '1': Asian '2': Caucasian '3': Hispanic '4': Native American '5': Other - name: juv_fel_count dtype: int64 - name: decile_score dtype: int64 - name: juv_misd_count dtype: int64 - name: juv_other_count dtype: int64 - name: priors_count dtype: int64 - name: days_b_screening_arrest dtype: int64 - name: c_jail_in dtype: string - name: c_jail_out dtype: string - name: c_case_number dtype: string - name: c_offense_date dtype: date32 - name: c_arrest_date dtype: date32 - name: c_days_from_compas dtype: int64 - name: c_charge_degree dtype: class_label: names: '0': F '1': M - name: c_charge_desc dtype: class_label: names: '0': Abuse Without Great Harm '1': Accessory After the Fact '2': Agg Abuse Elderlly/Disabled Adult '3': Agg Assault Law Enforc Officer '4': Agg Assault W/int Com Fel Dome '5': Agg Battery Grt/Bod/Harm '6': Agg Fleeing and Eluding '7': Agg Fleeing/Eluding High Speed '8': Aggr Child Abuse-Torture,Punish '9': Aggrav Battery w/Deadly Weapon '10': Aggrav Child Abuse-Agg Battery '11': Aggrav Child Abuse-Causes Harm '12': Aggrav Stalking After Injunctn '13': Aggravated Assault '14': Aggravated Assault W/Dead Weap '15': Aggravated Assault W/dead Weap '16': Aggravated Assault W/o Firearm '17': Aggravated Assault w/Firearm '18': Aggravated Battery '19': Aggravated Battery (Firearm) '20': Aggravated Battery (Firearm/Actual Possession) '21': Aggravated Battery / Pregnant '22': Aggravated Battery On 65/Older '23': Aggress/Panhandle/Beg/Solict '24': Aide/Abet Prostitution Lewdness '25': Aiding Escape '26': Alcoholic Beverage Violation-FL '27': Armed Trafficking in Cannabis '28': Arson II (Vehicle) '29': Arson in the First Degree '30': Assault '31': Assault Law Enforcement Officer '32': Att Burgl Conv Occp '33': Att Burgl Struc/Conv Dwel/Occp '34': Att Burgl Unoccupied Dwel '35': Att Tamper w/Physical Evidence '36': Attempt Armed Burglary Dwell '37': Attempt Burglary (Struct) '38': Attempted Burg/Convey/Unocc '39': Attempted Burg/struct/unocc '40': Attempted Deliv Control Subst '41': Attempted Robbery No Weapon '42': Attempted Robbery Weapon '43': Attempted Robbery Firearm '44': Battery '45': Battery Emergency Care Provide '46': Battery On A Person Over 65 '47': Battery On Fire Fighter '48': Battery On Parking Enfor Speci '49': Battery Spouse Or Girlfriend '50': Battery on Law Enforc Officer '51': Battery on a Person Over 65 '52': Bribery Athletic Contests '53': Burgl Dwel/Struct/Convey Armed '54': Burglary Assault/Battery Armed '55': Burglary Conveyance Armed '56': Burglary Conveyance Assault/Bat '57': Burglary Conveyance Occupied '58': Burglary Conveyance Unoccup '59': Burglary Dwelling Armed '60': Burglary Dwelling Assault/Batt '61': Burglary Dwelling Occupied '62': Burglary Structure Assault/Batt '63': Burglary Structure Occupied '64': Burglary Structure Unoccup '65': Burglary Unoccupied Dwelling '66': Burglary With Assault/battery '67': Carjacking w/o Deadly Weapon '68': Carjacking with a Firearm '69': Carry Open/Uncov Bev In Pub '70': Carrying A Concealed Weapon '71': Carrying Concealed Firearm '72': Cash Item w/Intent to Defraud '73': Cause Anoth Phone Ring Repeat '74': Child Abuse '75': Compulsory Attendance Violation '76': Compulsory Sch Attnd Violation '77': Computer Pornography '78': Consp Traff Oxycodone 4g><14g '79': Consp Traff Oxycodone 28g><30k '80': Conspiracy Dealing Stolen Prop '81': Conspiracy to Deliver Cocaine '82': Consume Alcoholic Bev Pub '83': Contradict Statement '84': Contribute Delinquency Of A Minor '85': Corrupt Public Servant '86': Counterfeit Lic Plates/Sticker '87': Crim Attempt/Solic/Consp '88': Crim Attempt/Solicit/Consp '89': Crim Use Of Personal Id Info '90': Crim Use of Personal ID Info '91': Crimin Mischief Damage $1000+ '92': Criminal Attempt 3rd Deg Felon '93': Criminal Mischief '94': Criminal Mischief Damage <$200 '95': Criminal Mischief>$200<$1000 '96': Crlty Twrd Child Urge Oth Act '97': Cruelty Toward Child '98': Cruelty to Animals '99': Culpable Negligence '100': D.U.I. Serious Bodily Injury '101': DOC/Cause Public Danger '102': DUI - Enhanced '103': DUI - Property Damage/Personal Injury '104': DUI Blood Alcohol Above 0.20 '105': DUI Level 0.15 Or Minor In Veh '106': DUI Property Damage/Injury '107': DUI- Enhanced '108': DUI/Property Damage/Persnl Inj '109': DWI w/Inj Susp Lic / Habit Off '110': DWLS Canceled Disqul 1st Off '111': DWLS Susp/Cancel Revoked '112': Dealing In Stolen Property '113': Dealing in Stolen Property '114': Defrauding Innkeeper '115': Defrauding Innkeeper $300/More '116': Del 3,4 Methylenedioxymethcath '117': Del Cannabis At/Near Park '118': Del Cannabis For Consideration '119': Del Morphine at/near Park '120': Del of JWH-250 2-Methox 1-Pentyl '121': Deliver 3,4 Methylenediox '122': Deliver Alprazolam '123': Deliver Cannabis '124': Deliver Cannabis 1000FTSch '125': Deliver Cocaine '126': Deliver Cocaine 1000FT Church '127': Deliver Cocaine 1000FT Park '128': Deliver Cocaine 1000FT School '129': Deliver Cocaine 1000FT Store '130': Delivery Of Drug Paraphernalia '131': Delivery of 5-Fluoro PB-22 '132': Delivery of Heroin '133': Depriv LEO of Protect/Communic '134': Discharge Firearm From Vehicle '135': Disorderly Conduct '136': Disorderly Intoxication '137': Disrupting School Function '138': Drivg While Lic Suspd/Revk/Can '139': Driving License Suspended '140': Driving Under The Influence '141': Driving While License Revoked '142': Escape '143': Exhibition Weapon School Prop '144': Expired DL More Than 6 Months '145': Exploit Elderly Person 20-100K '146': Exposes Culpable Negligence '147': Extradition/Defendants '148': Fabricating Physical Evidence '149': Fail Obey Driv Lic Restrictions '150': Fail Register Career Offender '151': Fail Register Vehicle '152': Fail Sex Offend Report Bylaw '153': Fail To Obey Police Officer '154': Fail To Redeliv Hire/Leas Prop '155': Fail To Redeliver Hire Prop '156': Fail To Secure Load '157': Failure To Pay Taxi Cab Charge '158': Failure To Return Hired Vehicle '159': False 911 Call '160': False Bomb Report '161': False Imprisonment '162': False Info LEO During Invest '163': False Motor Veh Insurance Card '164': False Name By Person Arrest '165': False Ownership Info/Pawn Item '166': Falsely Impersonating Officer '167': Fel Drive License Perm Revoke '168': Felon in Pos of Firearm or Amm '169': Felony Batt(Great Bodily Harm) '170': Felony Battery '171': Felony Battery (Dom Strang) '172': Felony Battery w/Prior Convict '173': Felony Committing Prostitution '174': Felony DUI (level 3) '175': Felony DUI - Enhanced '176': Felony Driving While Lic Suspd '177': Felony Petit Theft '178': Felony/Driving Under Influence '179': Fighting/Baiting Animals '180': Flee/Elude LEO-Agg Flee Unsafe '181': Fleeing Or Attmp Eluding A Leo '182': Fleeing or Eluding a LEO '183': Forging Bank Bills/Promis Note '184': Fraud Obtain Food or Lodging '185': Fraudulent Use of Credit Card '186': Gambling/Gamb Paraphernalia '187': Giving False Crime Report '188': Grand Theft (Motor Vehicle) '189': Grand Theft (motor Vehicle) '190': Grand Theft Dwell Property '191': Grand Theft Firearm '192': Grand Theft In The 3Rd Degree '193': Grand Theft in the 1st Degree '194': Grand Theft in the 3rd Degree '195': Grand Theft of a Fire Extinquisher '196': Grand Theft of the 2nd Degree '197': Grand Theft on 65 Yr or Older '198': Harass Witness/Victm/Informnt '199': Harm Public Servant Or Family '200': Hiring with Intent to Defraud '201': Imperson Public Officer or Emplyee '202': Insurance Fraud '203': Interfere W/Traf Cont Dev RR '204': Interference with Custody '205': Intoxicated/Safety Of Another '206': Introduce Contraband Into Jail '207': Issuing a Worthless Draft '208': Kidnapping / Domestic Violence '209': Lease For Purpose Trafficking '210': Leave Acc/Attend Veh/More $50 '211': Leave Accd/Attend Veh/Less $50 '212': Leaving Acc/Unattended Veh '213': Leaving the Scene of Accident '214': Lewd Act Presence Child 16- '215': Lewd or Lascivious Molestation '216': Lewd/Lasc Battery Pers 12+/<16 '217': Lewd/Lasc Exhib Presence <16yr '218': Lewd/Lasciv Molest Elder Persn '219': Lewdness Violation '220': License Suspended Revoked '221': Littering '222': Live on Earnings of Prostitute '223': Lve/Scen/Acc/Veh/Prop/Damage '224': Manage Busn W/O City Occup Lic '225': Manslaughter W/Weapon/Firearm '226': Manufacture Cannabis '227': Misuse Of 911 Or E911 System '228': Money Launder 100K or More Dols '229': Murder In 2nd Degree W/firearm '230': Murder in 2nd Degree '231': Murder in the First Degree '232': Neglect Child / Bodily Harm '233': Neglect Child / No Bodily Harm '234': Neglect/Abuse Elderly Person '235': Obstruct Fire Equipment '236': Obstruct Officer W/Violence '237': Obtain Control Substance By Fraud '238': Offer Agree Secure For Lewd Act '239': Offer Agree Secure/Lewd Act '240': Offn Against Intellectual Prop '241': Open Carrying Of Weapon '242': Oper Motorcycle W/O Valid DL '243': Operating W/O Valid License '244': Opert With Susp DL 2ND Offense '245': Opert With Susp DL 2nd Offens '246': PL/Unlaw Use Credit Card '247': Petit Theft '248': Petit Theft $100- $300 '249': Pos Cannabis For Consideration '250': Pos Cannabis W/Intent Sel/Del '251': Pos Methylenedioxymethcath W/I/D/S '252': Poss 3,4 MDMA (Ecstasy) '253': Poss Alprazolam W/int Sell/Del '254': Poss Anti-Shoplifting Device '255': Poss Cntrft Contr Sub w/Intent '256': Poss Cocaine/Intent To Del/Sel '257': Poss Contr Subst W/o Prescript '258': Poss Counterfeit Payment Inst '259': Poss Drugs W/O A Prescription '260': Poss F/Arm Delinq '261': Poss Firearm W/Altered ID# '262': Poss Meth/Diox/Meth/Amp (MDMA) '263': Poss Of 1,4-Butanediol '264': Poss Of Controlled Substance '265': Poss Of RX Without RX '266': Poss Oxycodone W/Int/Sell/Del '267': Poss Pyrrolidinobutiophenone '268': Poss Pyrrolidinovalerophenone '269': Poss Pyrrolidinovalerophenone W/I/D/S '270': Poss Similitude of Drivers Lic '271': Poss Tetrahydrocannabinols '272': Poss Trifluoromethylphenylpipe '273': Poss Unlaw Issue Driver Licenc '274': Poss Unlaw Issue Id '275': Poss Wep Conv Felon '276': Poss of Cocaine W/I/D/S 1000FT Park '277': Poss of Firearm by Convic Felo '278': Poss of Methylethcathinone '279': Poss of Vessel w/Altered ID NO '280': Poss/Sell/Del Cocaine 1000FT Sch '281': Poss/Sell/Del/Man Amobarbital '282': Poss/Sell/Deliver Clonazepam '283': Poss/pur/sell/deliver Cocaine '284': Poss3,4 Methylenedioxymethcath '285': Posses/Disply Susp/Revk/Frd DL '286': Possess Cannabis 1000FTSch '287': Possess Cannabis/20 Grams Or Less '288': Possess Controlled Substance '289': Possess Countrfeit Credit Card '290': Possess Drug Paraphernalia '291': 'Possess Mot Veh W/Alt Vin #' '292': Possess Tobacco Product Under 18 '293': Possess Weapon On School Prop '294': Possess w/I/Utter Forged Bills '295': Possess/Use Weapon 1 Deg Felon '296': Possession Burglary Tools '297': Possession Child Pornography '298': Possession Firearm School Prop '299': Possession Of 3,4Methylenediox '300': Possession Of Alprazolam '301': Possession Of Amphetamine '302': Possession Of Anabolic Steroid '303': Possession Of Buprenorphine '304': Possession Of Carisoprodol '305': Possession Of Clonazepam '306': Possession Of Cocaine '307': Possession Of Diazepam '308': Possession Of Fentanyl '309': Possession Of Heroin '310': Possession Of Lorazepam '311': Possession Of Methamphetamine '312': Possession Of Paraphernalia '313': Possession Of Phentermine '314': Possession of Alcohol Under 21 '315': Possession of Benzylpiperazine '316': Possession of Butylone '317': Possession of Cannabis '318': Possession of Cocaine '319': Possession of Codeine '320': Possession of Ethylone '321': Possession of Hydrocodone '322': Possession of Hydromorphone '323': Possession of LSD '324': Possession of Methadone '325': Possession of Morphine '326': Possession of Oxycodone '327': Possession of XLR11 '328': Present Proof of Invalid Insur '329': Principal In The First Degree '330': Prostitution '331': Prostitution/Lewd Act Assignation '332': Prostitution/Lewdness/Assign '333': Prowling/Loitering '334': Purchase Cannabis '335': Purchase Of Cocaine '336': Purchase/P/W/Int Cannabis '337': Purchasing Of Alprazolam '338': Reckless Driving '339': Refuse Submit Blood/Breath Test '340': Refuse to Supply DNA Sample '341': Resist Officer w/Violence '342': Resist/Obstruct W/O Violence '343': Restraining Order Dating Viol '344': Retail Theft $300 1st Offense '345': Retail Theft $300 2nd Offense '346': Ride Tri-Rail Without Paying '347': Robbery / No Weapon '348': Robbery / Weapon '349': Robbery Sudd Snatch No Weapon '350': Robbery W/Deadly Weapon '351': Robbery W/Firearm '352': Sale/Del Cannabis At/Near Scho '353': Sale/Del Counterfeit Cont Subs '354': Sel Etc/Pos/w/Int Contrft Schd '355': Sel/Pur/Mfr/Del Control Substa '356': Sell Cannabis '357': Sell Conterfeit Cont Substance '358': Sell or Offer for Sale Counterfeit Goods '359': Sell/Man/Del Pos/w/int Heroin '360': Sex Batt Faml/Cust Vict 12-17Y '361': Sex Battery Deft 18+/Vict 11- '362': Sex Offender Fail Comply W/Law '363': Sexual Battery / Vict 12 Yrs + '364': Sexual Performance by a Child '365': Shoot In Occupied Dwell '366': Shoot Into Vehicle '367': Simulation of Legal Process '368': Solic to Commit Battery '369': Solicit Deliver Cocaine '370': Solicit Purchase Cocaine '371': Solicit To Deliver Cocaine '372': Solicitation On Felony 3 Deg '373': Soliciting For Prostitution '374': Sound Articles Over 100 '375': Stalking '376': Stalking (Aggravated) '377': Strong Armed Robbery '378': Structuring Transactions '379': Susp Drivers Lic 1st Offense '380': Tamper With Victim '381': Tamper With Witness '382': Tamper With Witness/Victim/CI '383': Tampering With Physical Evidence '384': Tampering with a Victim '385': Theft '386': Theft/To Deprive '387': Threat Public Servant '388': Throw Deadly Missile Into Veh '389': Throw In Occupied Dwell '390': Throw Missile Into Pub/Priv Dw '391': Traff In Cocaine <400g>150 Kil '392': Traffic Counterfeit Cred Cards '393': Traffick Amphetamine 28g><200g '394': Traffick Hydrocodone 4g><14g '395': Traffick Oxycodone 4g><14g '396': Trans/Harm/Material to a Minor '397': Trespass On School Grounds '398': Trespass Other Struct/Conve '399': Trespass Private Property '400': Trespass Property w/Dang Weap '401': Trespass Struct/Convey Occupy '402': Trespass Struct/Conveyance '403': Trespass Structure w/Dang Weap '404': Trespass Structure/Conveyance '405': Trespassing/Construction Site '406': Tresspass Struct/Conveyance '407': Tresspass in Structure or Conveyance '408': Unauth C/P/S Sounds>1000/Audio '409': Unauth Poss ID Card or DL '410': Unauthorized Interf w/Railroad '411': Unemployment Compensatn Fraud '412': Unl/Disturb Education/Instui '413': Unlaw Lic Use/Disply Of Others '414': Unlaw LicTag/Sticker Attach '415': Unlaw Use False Name/Identity '416': Unlawful Conveyance of Fuel '417': Unlawful Use Of Police Badges '418': Unlicensed Telemarketing '419': Use Computer for Child Exploit '420': Use Of 2 Way Device To Fac Fel '421': Use Scanning Device to Defraud '422': Use of Anti-Shoplifting Device '423': Uttering Forged Bills '424': Uttering Forged Credit Card '425': Uttering Worthless Check +$150 '426': Uttering a Forged Instrument '427': Video Voyeur-<24Y on Child >16 '428': Viol Injunct Domestic Violence '429': Viol Injunction Protect Dom Vi '430': Viol Pretrial Release Dom Viol '431': Viol Prot Injunc Repeat Viol '432': Violation License Restrictions '433': Violation Of Boater Safety Id '434': Violation of Injunction Order/Stalking/Cyberstalking '435': Voyeurism '436': arrest case no charge - name: is_recid dtype: class_label: names: '0': 0 '1': 1 - name: r_case_number dtype: string - name: r_charge_degree dtype: class_label: names: '0': (CO3) '1': (F1) '2': (F2) '3': (F3) '4': (F5) '5': (F6) '6': (F7) '7': (M1) '8': (M2) '9': (MO3) - name: r_days_from_arrest dtype: int64 - name: r_offense_date dtype: date32 - name: r_charge_desc dtype: string - name: r_jail_in dtype: date32 - name: r_jail_out dtype: date32 - name: violent_recid dtype: string - name: is_violent_recid dtype: class_label: names: '0': 0 '1': 1 - name: vr_case_number dtype: string - name: vr_charge_degree dtype: class_label: names: '0': (F1) '1': (F2) '2': (F3) '3': (F5) '4': (F6) '5': (F7) '6': (M1) '7': (M2) '8': (MO3) - name: vr_offense_date dtype: date32 - name: vr_charge_desc dtype: string - name: type_of_assessment dtype: class_label: names: '0': Risk of Recidivism - name: decile_score.1 dtype: int64 - name: score_text dtype: class_label: names: '0': High '1': Low '2': Medium - name: screening_date dtype: date32 - name: v_type_of_assessment dtype: class_label: names: '0': Risk of Violence - name: v_decile_score dtype: int64 - name: v_score_text dtype: class_label: names: '0': High '1': Low '2': Medium - name: v_screening_date dtype: date32 - name: in_custody dtype: date32 - name: out_custody dtype: date32 - name: priors_count.1 dtype: int64 - name: start dtype: int64 - name: end dtype: int64 - name: event dtype: class_label: names: '0': 0 '1': 1 - name: two_year_recid dtype: class_label: names: '0': 0 '1': 1 splits: - name: train num_bytes: 3117420 num_examples: 7214 download_size: 1002829 dataset_size: 3117420 configs: - config_name: default data_files: - split: train path: data/train-* --- # Dataset Card for Correctional Offender Management Profiling for Alternative Sanctions (COMPAS, scores-two-years) This dataset is a precise version of [compas-scores-two-years.csv](https://github.com/propublica/compas-analysis/blob/master/compas-scores-two-years.csv) as given in the compas-analysis [notebook](https://github.com/propublica/compas-analysis/blob/master/Compas%20Analysis.ipynb). There are more "versions" of compas data, *e.g.*, the "main dataset" ```compas.db``` that contains criminal history, etc. and COMPAS risk scores for defendants from Broward County. However, those versions are not covered here, and we did not get enough time to check how they are related to the current ```compas-scores-two-years.csv```. We used the following python script to create this Hugging Face dataset. ```python # Load the dataset into a pandas DataFrame import pandas as pd df_compas = pd.read_csv("https://github.com/propublica/compas-analysis/raw/master/compas-scores-two-years.csv") from datasets import Dataset, DatasetDict, Features, Value, ClassLabel # Define continuous (numerical) and categorical columns categorical_columns = { "sex", "age_cat", "race", "c_charge_degree", "c_charge_desc", "is_recid", "r_charge_degree", "violent_recid", "is_violent_recid", "vr_charge_degree", "type_of_assessment", "score_text", "v_type_of_assessment", "v_score_text", "event", "two_year_recid" } string_columns = {'c_case_number', 'first', 'last', 'name', 'r_case_number', 'r_charge_desc', 'violent_recid', 'vr_case_number', 'vr_charge_desc', 'c_jail_in', 'c_jail_out' } date_columns = {'compas_screening_date', 'c_offense_date', 'c_arrest_date', 'r_offense_date', 'vr_offense_date', 'screening_date', 'v_screening_date','dob', 'r_jail_in', 'r_jail_out', 'in_custody', 'out_custody'} # Convert categorical columns to category type and store mappings category_mappings = {} for col in categorical_columns: category_mappings[col] = list(df_compas[col].astype('category').cat.categories) # Define Hugging Face dataset schema hf_features = Features({ col: Value("date32") if col in date_columns else Value("string") if col in string_columns else ClassLabel(names=category_mappings[col]) if col in categorical_columns else Value("int64") for col in df_compas.columns }) # Create a dataset dictionary hf_dataset = DatasetDict({ "train": Dataset.from_pandas(df_compas, features=hf_features), }) # Print dataset structure print(hf_dataset) ``` The printed output could look like ``` DatasetDict({ train: Dataset({ features: ['id', 'name', 'first', 'last', 'compas_screening_date', 'sex', 'dob', 'age', 'age_cat', 'race', 'juv_fel_count', 'decile_score', 'juv_misd_count', 'juv_other_count', 'priors_count', 'days_b_screening_arrest', 'c_jail_in', 'c_jail_out', 'c_case_number', 'c_offense_date', 'c_arrest_date', 'c_days_from_compas', 'c_charge_degree', 'c_charge_desc', 'is_recid', 'r_case_number', 'r_charge_degree', 'r_days_from_arrest', 'r_offense_date', 'r_charge_desc', 'r_jail_in', 'r_jail_out', 'violent_recid', 'is_violent_recid', 'vr_case_number', 'vr_charge_degree', 'vr_offense_date', 'vr_charge_desc', 'type_of_assessment', 'decile_score.1', 'score_text', 'screening_date', 'v_type_of_assessment', 'v_decile_score', 'v_score_text', 'v_screening_date', 'in_custody', 'out_custody', 'priors_count.1', 'start', 'end', 'event', 'two_year_recid'], num_rows: 7214 }) }) ``` Also, according to the compas-analysis [notebook](https://github.com/propublica/compas-analysis/blob/master/Compas%20Analysis.ipynb), we also checked the number of "usable" rows as follows. ```python ((df_compas['score_text'] != 'N/A').values & ( df_compas['is_recid'] != -1).values & ( df_compas['c_charge_degree'] != 'O').values & ( df_compas['days_b_screening_arrest'] <= 30).values & ( df_compas['days_b_screening_arrest'] >= -30).values).sum() ``` which should return 6172 as expected. This number could also serve as a standardised cleaning scheme.