from typing import List import datasets import pandas import gzip VERSION = datasets.Version("1.0.0") DESCRIPTION = "Toxicity dataset from the UCI ML repository." _HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/728/toxicity" _URLS = ("https://archive-beta.ics.uci.edu/dataset/728/toxicity") _CITATION = """""" # Dataset info urls_per_split = { "train": "https://huggingface.co/datasets/mstz/toxicity/raw/main/data.csv" } _BASE_FEATURE_NAMES = [ "MATS3v", "nHBint10", "MATS3s", "MATS3p", "nHBDon_Lipinski", "minHBint8", "MATS3e", "MATS3c", "minHBint2", "MATS3m", "minHBint6", "minHBint7", "minHBint4", "MATS3i", "VR3_Dt", "SpMax8_Bhi", "SdsN", "SpMax8_Bhm", "SpMax8_Bhe", "ECCEN", "MDEC-14", "SpMax8_Bhs", "SpMax8_Bhp", "SpMax8_Bhv", "MDEC-11", "MDEC-12", "MDEC-13", "VR2_Dt", "BIC5", "ATS7s", "ATS7p", "ATS7v", "ATS7i", "ATS7m", "ATS7e", "mintN", "nHsNH2", "khs.sssCH", "minHBint3", "maxdssC", "nT6Ring", "minHBint5", "nF8Ring", "minssCH2", "SpMax_DzZ", "ETA_EtaP", "nHsOH", "SpMin1_Bhe", "maxHother", "nHBAcc_Lipinski", "StN", "khs.aaS", "khs.aaO", "khs.aaN", "Sare", "SHAvin", "SpMax3_Bhv", "SpMax3_Bhp", "SpMax3_Bhs", "SpMax3_Bhe", "SpMin6_Bhi", "SpMax3_Bhm", "SpMax3_Bhi", "ETA_EtaP_F_L", "mindCH2", "AATSC2e", "AATSC2c", "AATSC2m", "AATSC2i", "nsBr", "AATS5p", "AATSC2v", "AATSC2p", "AATSC2s", "VABC", "maxdNH", "khs.ddsN", "RotBtFrac", "ATS4e", "ATS4m", "nFRing", "ATS4i", "EE_DzZ", "ATS4s", "ATS4p", "ETA_Alpha", "khs.sssN", "EE_Dzi", "MAXDN", "EE_Dzm", "EE_Dze", "EE_Dzs", "EE_Dzp", "EE_Dzv", "ATS8e", "maxsOH", "minssssNp", "maxsOm", "MDEC-23", "MDEC-22", "MDEC-24", "nFG12HeteroRing", "ATS8s", "ATS8v", "SP-6", "SP-7", "SHsNH2", "SP-5", "SP-2", "SP-3", "SP-0", "SP-1", "minHsOH", "ATSC8v", "MATS2v", "ATSC8s", "MATS2p", "MATS2s", "ATSC8p", "MATS2e", "ATSC8e", "ATSC8c", "MATS2c", "MATS2m", "topoDiameter", "ATSC8m", "MATS2i", "ATSC8i", "ntN", "khs.ssCH2", "SpAD_Dt", "ETA_Eta_R_L", "SHdsCH", "SaasN", "SC-4", "SaasC", "minaaCH", "AATSC3c", "AATSC3e", "AATSC3i", "AATSC3m", "AATSC3s", "AATSC3p", "AATSC3v", "SpMax2_Bhp", "nF8HeteroRing", "AATS8e", "AATS8i", "AATS8m", "AATS8s", "AATS8p", "AATS8v", "VE3_Dt", "XLogP", "SpMax2_Bhi", "maxssCH2", "minaaS", "SpMax4_Bhv", "SpMax4_Bhs", "SpMax4_Bhp", "SpMax4_Bhm", "minHaaNH", "SpMax4_Bhi", "minaaN", "SpMax4_Bhe", "StsC", "SssCH2", "maxHdNH", "MATS1p", "R_TpiPCTPC", "MATS1s", "MATS1v", "JGI10", "MATS1c", "MATS1e", "VR2_DzZ", "MATS1i", "MATS1m", "MDEC-34", "MDEC-33", "VR2_Dze", "VR2_Dzm", "VR2_Dzs", "VR2_Dzp", "khs.ssssC", "nTG12Ring", "khs.ssssN", "ATS5e", "gmin", "VR2_D", "ATS5m", "ATS5p", "ATS5s", "ATS5v", "AATSC5p", "TpiPC", "maxsCH3", "SdS", "khs.ssO", "ETA_Eta_F_L", "khs.ssS", "SdO", "VE2_Dt", "maxHtCH", "SpMax_Dze", "SpMax_Dzm", "SpMax_Dzi", "ETA_dEpsilon_B", "SpMax_Dzv", "ETA_dEpsilon_A", "SpMax_Dzs", "ETA_dEpsilon_D", "SpMax_Dzp", "SsNH2", "StCH", "SsCH3", "CIC5", "CIC4", "CIC1", "CIC0", "CIC3", "CIC2", "nF10HeteroRing", "maxssO", "WPOL", "n5HeteroRing", "maxHAvin", "fragC", "ETA_Eta_B_RC", "AATS7m", "SpDiam_Dt", "SdssC", "ETA_Epsilon_3", "AATS7i", "AATS7e", "nT9Ring", "minsCl", "AATS7v", "AATS7s", "AATS7p", "nHdCH2", "ETA_Epsilon_5", "ETA_Epsilon_4", "SsssCH", "maxHsOH", "GATS1v", "maxaaaC", "GATS1s", "minsNH2", "BIC4", "SpMin7_Bhs", "SpMin7_Bhp", "SpMin7_Bhv", "nHtCH", "GATS1e", "mintsC", "GATS1c", "SpMin7_Bhm", "GATS1m", "SpMin7_Bhe", "GATS1i", "maxtsC", "minHAvin", "MDEC-44", "AATS2v", "SPC-6", "SPC-4", "SPC-5", "SpAD_D", "MATS6c", "ETA_BetaP_s", "minaasC", "minaasN", "minssNH", "nT7HeteroRing", "RotBFrac", "nF10Ring", "ETA_BetaP_ns", "nH", "nL", "nN", "nO", "nA", "nC", "nF", "nX", "nQ", "nS", "nV", "ATS1m", "SdNH", "mindsN", "SHCsats", "SHCsatu", "CrippenMR", "GATS1p", "SRW10", "ETA_dPsi_A", "AATS6m", "AATS6i", "AATS6e", "minsBr", "nF9HeteroRing", "SpMin7_Bhi", "AATS6v", "AATS6p", "AATS6s", "naAromAtom", "nBase", "minHBint10", "SpDiam_DzZ", "SaaNH", "nssssC", "khs.dNH", "maxaaN", "maxaaO", "SpDiam_Dzv", "SpDiam_Dzs", "SpDiam_Dzp", "SpDiam_Dze", "SpDiam_Dzm", "GATS6i", "SpDiam_Dzi", "Mi", "Mv", "Mp", "GGI10", "nBr", "bpol", "MW", "GATS6v", "MATS7s", "MATS7p", "C1SP1", "MATS7v", "MATS7i", "MATS7m", "MATS7c", "GATS6s", "MATS7e", "maxtN", "SpMin8_Bhe", "SpMin8_Bhi", "SpMin8_Bhm", "SpMin8_Bhp", "SpMin8_Bhs", "SpMin8_Bhv", "maxHCsatu", "maxHCsats", "ATSC3v", "ATSC3s", "ATSC3p", "minHdCH2", "ATSC3e", "ATSC3c", "maxssNH", "ATSC3m", "ATSC3i", "minHCsatu", "minHCsats", "SpMax7_Bhe", "SpMax7_Bhi", "SpMax7_Bhm", "ETA_BetaP_ns_d", "SpMax7_Bhp", "SpMax7_Bhs", "SpMax7_Bhv", "SdsCH", "minssO", "minssS", "SpMin3_Bhe", "SpMin3_Bhm", "SpMin3_Bhi", "SpMin3_Bhv", "nT8Ring", "SpMin3_Bhs", "SpMin3_Bhp", "TPC", "khs.tCH", "VP-5", "VP-4", "VP-7", "VP-6", "VP-1", "VP-0", "VP-3", "VP-2", "MIC5", "MIC4", "MIC3", "MIC2", "MIC1", "MIC0", "ATSC5p", "piPC10", "ATSC5s", "minsOm", "nT10HeteroRing", "nHBa", "nHBd", "SddssS", "nCl", "minsOH", "SHaaCH", "nHBDon", "nF11HeteroRing", "AATS5i", "AATS5m", "SpMin6_Bhs", "SpMin6_Bhp", "SpMin6_Bhv", "AATS5e", "ETA_dBeta", "khs.sCH3", "ALogP", "SpMin6_Bhm", "BCUTp-1l", "AATS5s", "BCUTp-1h", "AATS5v", "SpMin6_Bhe", "ATS8i", "ATS8m", "BCUTw-1h", "BCUTw-1l", "nBondsS3", "nBondsS2", "ATS8p", "GATS3p", "GATS3s", "GATS3v", "GATS3c", "GATS3e", "SC-5", "GATS3i", "SC-6", "GATS3m", "SC-3", "minsCH3", "SssssC", "nAtomLC", "nT12HeteroRing", "minHaaCH", "MLFER_BH", "MLFER_BO", "SaaaC", "mindsCH", "nddssS", "maxaasC", "maxsssN", "MATS6p", "MATS6s", "MATS6v", "MATS6i", "MATS6m", "MATS6e", "ETA_Beta_ns_d", "hmax", "ETA_Beta_s", "nHaaCH", "khs.aaaC", "khs.sNH2", "ETA_AlphaP", "nAromBond", "ATSC2v", "ATSC2p", "ATSC2s", "ATS4v", "ATSC2e", "ATSC2c", "ATSC2m", "ATSC2i", "AATS4v", "AATS4s", "AATS4p", "AATS4e", "ETA_BetaP", "AATS4m", "khs.sOH", "AATS4i", "SHsOH", "SpMax_D", "MDEN-13", "MDEN-12", "MDEN-11", "ntsC", "ATS3m", "PetitjeanNumber", "khs.aasN", "khs.aasC", "MWC10", "MPC7", "TWC", "topoRadius", "WPATH", "nG", "ndsN", "MAXDP", "naaaC", "SM1_DzZ", "SpAbs_DzZ", "SpAbs_Dze", "khs.aaNH", "SpAbs_Dzm", "SM1_Dzv", "SpAbs_Dzi", "SM1_Dzp", "SM1_Dzs", "SM1_Dzm", "SpAbs_Dzv", "SM1_Dzi", "SpAbs_Dzp", "SpAbs_Dzs", "SM1_Dze", "maxaaCH", "maxdO", "nF11Ring", "GATS2v", "GATS2s", "ETA_Beta", "GATS2m", "GATS2i", "maxdS", "GATS2e", "GATS2c", "nHaaNH", "ATSC1p", "ATSC1s", "ATSC1v", "ATSC1c", "ATSC1e", "ATSC1i", "ATSC1m", "MWC9", "MWC8", "MWC5", "MWC4", "MWC7", "MWC6", "ndssC", "MWC2", "MAXDN2", "MATS5e", "SpMin2_Bhe", "MATS5c", "MATS5m", "SpMin2_Bhm", "MATS5i", "SpMin2_Bhi", "SpMin2_Bhv", "MATS5v", "MATS5p", "SpMin2_Bhs", "SpMin2_Bhp", "VE1_Dzi", "Mare", "BCUTc-1l", "BCUTc-1h", "SssNH", "MPC9", "VE1_Dzp", "naaN", "naaO", "naaS", "SsBr", "SHBd", "TSRW", "SHBa", "khs.ssNH", "nT9HeteroRing", "SpMax6_Bhp", "SpMax6_Bhs", "SpMAD_Dzv", "SpMax6_Bhv", "SpMax6_Bhe", "SpMAD_Dze", "SpMax6_Bhi", "SpMAD_Dzi", "SpMax6_Bhm", "SpMAD_Dzm", "SpMAD_DzZ", "AATSC8s", "AATSC8p", "AATSC8v", "minHssNH", "AATSC8c", "AATSC8e", "AATSC8i", "AATSC8m", "AATS3s", "AATS3p", "AATS3v", "SpMin5_Bhv", "SpMin5_Bhp", "SpMin5_Bhs", "SpMin5_Bhm", "SpMin5_Bhi", "AATS3e", "SpMin5_Bhe", "AATS3i", "SpMAD_Dzs", "AATS3m", "n7Ring", "maxdCH2", "MLFER_L", "GATS5s", "GATS5p", "GATS5v", "MLFER_A", "GATS5i", "GATS5m", "IC3", "IC2", "IC1", "IC0", "khs.tN", "IC5", "IC4", "ETA_Eta_R", "ETA_Eta_L", "SHdCH2", "ETA_Eta_B", "ETA_Eta_F", "SaaCH", "nAcid", "maxsssCH", "SsCl", "nF6Ring", "maxsF", "MATS4c", "MATS4e", "MATS4i", "SP-4", "MATS4m", "MATS4s", "MATS4p", "MATS4v", "minHdNH", "VC-6", "SsssN", "minaaaC", "minwHBa", "nT6HeteroRing", "khs.dssC", "AATSC0m", "EE_Dt", "minsF", "ATSC0v", "ATSC0s", "ATSC0p", "ATSC0m", "ATSC0i", "ATSC0e", "ATSC0c", "VE2_D", "SpMAD_D", "nHBint2", "nHBint3", "ETA_Epsilon_1", "nHBint6", "nHBint7", "nHBint4", "nHBint5", "nHBint8", "nHBint9", "nBondsS", "AATS2p", "AATS2s", "nBondsT", "AATS2e", "nBondsD", "AATS2i", "AATS2m", "nBondsM", "nBonds2", "MDEN-33", "Sp", "Sv", "Si", "FMF", "nRotB", "n7HeteroRing", "minssssC", "SwHBa", "Zagreb", "SRW6", "SRW7", "SRW4", "SRW5", "SRW2", "khs.sCl", "SRW8", "SRW9", "maxHsNH2", "SCH-5", "SCH-6", "SCH-7", "khs.sF", "nF9Ring", "ATS6p", "maxaasN", "MAXDP2", "minHtCH", "nsNH2", "nFG12Ring", "VE1_DzZ", "VE1_Dze", "GATS4p", "GATS4s", "VE1_Dzm", "GATS4v", "GATS4i", "VE1_Dzs", "GATS4m", "ndsCH", "VE1_Dzv", "GATS4c", "GATS4e", "ETA_Beta_ns", "McGowan_Volume", "n5Ring", "ETA_dAlpha_B", "ATSC7s", "ATSC7p", "ETA_dAlpha_A", "ATSC7v", "ATSC7i", "ATSC7m", "ATSC7c", "VC-4", "VC-5", "VC-3", "ATSC7e", "maxssssNp", "JGI2", "JGI3", "JGI1", "JGI6", "JGI7", "JGI4", "JGI5", "JGI8", "JGI9", "SpAD_DzZ", "SpAD_Dze", "SpAD_Dzm", "SpAD_Dzi", "SpAD_Dzv", "SpAD_Dzp", "SpAD_Dzs", "nsssCH", "nBonds", "LipinskiFailures", "SpDiam_D", "minHdsCH", "SssO", "SssS", "C2SP3", "C2SP2", "C2SP1", "GATS2p", "ETA_Shape_X", "ETA_Shape_Y", "ETA_Shape_P", "naaNH", "khs.dCH2", "AVP-5", "AVP-4", "AVP-7", "AVP-1", "AVP-0", "AVP-2", "AATS1v", "AATS1p", "AATS1s", "AATS1m", "MDEN-22", "AATS1i", "AATS1e", "maxaaNH", "maxHaaNH", "nT8HeteroRing", "GATS7c", "GATS7m", "GATS7v", "GATS7p", "GATS7s", "SsOm", "SsOH", "AATSC4v", "maxHBd", "AATSC4s", "khs.sBr", "maxHBa", "khs.dsN", "SHssNH", "AATSC4e", "AATSC4c", "AATSC4m", "AATSC4i", "SHBint10", "ATS2v", "ATS2p", "ATS2s", "CrippenLogP", "ATS2i", "JGT", "MPC10", "ndNH", "VAdjMat", "khs.ddssS", "nT7Ring", "khs.dsCH", "ATSC6p", "ATSC6s", "ATSC6v", "ATSC6i", "ATSC6m", "ATSC6c", "ATSC6e", "SpMin1_Bhi", "SpMin1_Bhm", "SpMin1_Bhp", "SpMin1_Bhs", "nT11HeteroRing", "SpMin1_Bhv", "SHother", "AATS0s", "SpMin4_Bhv", "AATS0p", "SpMin4_Bhp", "AATS0v", "SpMin4_Bhs", "SpMin4_Bhm", "AATS0i", "SpMin4_Bhi", "AATS0m", "minsssCH", "SpMin4_Bhe", "nAtomLAC", "AATS0e", "nsCH3", "MWC3", "ATSC5v", "MLFER_S", "ETA_dBetaP", "AATSC4p", "nRotBt", "nsOm", "SHaaNH", "nsOH", "AATSC5v", "AATSC5s", "nssssNp", "AATSC5e", "naasN", "AATSC5c", "AATSC5m", "nsssN", "SpMax_Dt", "AATSC5i", "naasC", "VR3_D", "VR1_D", "VR1_Dt", "ETA_Epsilon_2", "MLogP", "nHBAcc2", "nHBAcc3", "AMR", "AMW", "GATS6c", "sumI", "GATS6e", "gmax", "maxHssNH", "MATS5s", "maxsNH2", "GATS6m", "maxHBint8", "maxHBint9", "GATS6p", "C1SP2", "C1SP3", "khs.tsC", "maxHBint2", "maxHBint3", "maxHBint4", "maxHBint5", "maxHBint6", "maxHBint7", "AVP-6", "nHdNH", "ATSC5e", "C4SP3", "AVP-3", "ATSC5c", "ATSC5m", "nHother", "ATSC5i", "VCH-5", "VCH-7", "VCH-6", "Mse", "nsF", "DELS2", "MATS8m", "ATS3v", "ATS3s", "ATS3p", "ATS3e", "MATS8i", "Kier2", "Kier3", "Kier1", "HybRatio", "ATS3i", "MDEN-23", "SHBint9", "SHBint8", "SHBint3", "SHBint2", "SHBint7", "SHBint6", "SHBint5", "SHBint4", "DELS", "minHsNH2", "nHeteroRing", "GATS7e", "ETA_Psi_1", "mindssC", "nwHBa", "maxHBint10", "mindNH", "GATS7i", "nHssNH", "nAtom", "Spe", "khs.dS", "khs.dO", "maxwHBa", "AATSC6p", "AATSC6s", "AATSC6v", "AATSC6c", "AATSC6e", "AATSC6i", "AATSC6m", "SssssNp", "AATSC7c", "nssCH2", "ASP-2", "ASP-3", "ASP-0", "ASP-1", "ASP-6", "ASP-7", "ASP-4", "ASP-5", "ATS0s", "MATS8v", "ATS0p", "MATS8s", "ATS0v", "MATS8p", "MATS8e", "MATS8c", "ATS0e", "ATS0i", "ATS0m", "GGI9", "GGI8", "GGI1", "GGI3", "GGI2", "GGI5", "GGI4", "GGI7", "GGI6", "nTRing", "nT10Ring", "TIC0", "TIC1", "TIC2", "TIC3", "TIC4", "TIC5", "maxsCl", "ntCH", "khs.aaCH", "ZMIC4", "ZMIC5", "ZMIC0", "ZMIC1", "ZMIC2", "ZMIC3", "minHother", "ATSC4c", "ATSC4e", "ATSC4i", "ATSC4m", "ATSC4s", "ATSC4p", "ATSC4v", "SpMax1_Bhs", "SpMax1_Bhp", "SpMax1_Bhv", "hmin", "SpMax1_Bhe", "SpMax1_Bhi", "SpMax1_Bhm", "MPC6", "nAtomP", "MPC4", "MPC5", "MPC2", "VR3_Dzv", "VR3_Dzs", "MPC8", "VR3_Dzp", "VR3_Dzm", "SpMAD_Dzp", "VR3_Dzi", "VR3_Dze", "SsF", "minaaO", "VR3_DzZ", "mintCH", "Sse", "C3SP2", "VR1_DzZ", "VR1_Dzp", "VR1_Dzs", "SdCH2", "SHtCH", "VR1_Dzi", "VR1_Dzm", "VR1_Dze", "maxdsN", "AATSC7v", "AATSC7s", "AATSC7p", "AATSC7m", "AATSC7i", "nHdsCH", "AATSC7e", "BIC2", "BIC3", "BIC0", "BIC1", "SIC5", "SIC4", "SIC1", "SIC0", "SIC3", "SIC2", "naaCH", "minHBd", "minHBa", "AATSC1p", "nssO", "AATSC0i", "ALogp2", "nssS", "AATSC1i", "SaaS", "SaaO", "SaaN", "maxsBr", "GATS8m", "SpMax2_Bhv", "GATS8i", "SpMax2_Bhs", "GATS8e", "GATS8c", "SpMax2_Bhe", "SpMax2_Bhm", "GATS8v", "GATS8p", "GATS8s", "piPC3", "piPC2", "piPC1", "piPC7", "piPC6", "piPC5", "piPC4", "piPC9", "piPC8", "maxHdsCH", "nT11Ring", "ATS1v", "ATS1p", "ATS1s", "ATS1i", "SpMAD_Dt", "ATS1e", "VR2_Dzi", "n6HeteroRing", "MPC3", "ATS2e", "VR2_Dzv", "minHBint9", "VE2_Dzs", "VE2_Dzp", "VE2_Dzv", "ATS2m", "VE2_Dzi", "VE2_Dzm", "maxtCH", "minaaNH", "VE2_Dze", "VE2_DzZ", "nHAvin", "meanI", "nHCsatu", "nHCsats", "apol", "ATS5i", "nF12Ring", "mindS", "mindO", "MolIP", "maxdsCH", "ndCH2", "TopoPSA", "ETA_EtaP_B_RC", "MDEO-11", "MDEO-12", "AATSC0s", "SpMax5_Bhv", "AATSC0p", "SpMax5_Bhs", "AATSC0v", "SpMax5_Bhp", "SpMax5_Bhm", "SpMax5_Bhi", "AATSC0c", "SpMax5_Bhe", "AATSC0e", "EE_D", "VE3_DzZ", "C3SP3", "VE3_Dzv", "minddssS", "ATS6s", "VE3_Dzs", "VE3_Dzp", "ATS6v", "ATS6i", "VE3_Dzm", "ATS6m", "VE3_Dzi", "VE3_Dze", "ATS6e", "nTG12HeteroRing", "VPC-6", "VPC-5", "VPC-4", "MLFER_E", "nBondsD2", "nT12Ring", "Mpe", "maxHdCH2", "nT5HeteroRing", "nHeavyAtom", "nRing", "GATS5c", "nF12HeteroRing", "GATS5e", "VR1_Dzv", "minsssN", "topoShape", "ndO", "ndS", "nssNH", "VE1_Dt", "maxHaaCH", "nHBAcc", "VE3_D", "nsCl", "VE1_D", "AATSC1s", "AATSC1v", "AATSC1m", "AATSC1c", "AATSC1e", "LipoaffinityIndex", "n6Ring", "ETA_Eta", "WTPT-1", "WTPT-2", "WTPT-3", "WTPT-4", "WTPT-5", "ETA_EtaP_L", "ETA_EtaP_F", "ETA_EtaP_B", "nT5Ring", "SHdNH", "ETA_dEpsilon_C", "MDEO-22", "is_toxic" ] features_types_per_config = { "toxicity": {f: datasets.Value("float32") for f in _BASE_FEATURE_NAMES[:-1]} } features_types_per_config["toxicity"]["is_toxic"] = datasets.ClassLabel(num_classes=2) features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config} class ToxicityConfig(datasets.BuilderConfig): def __init__(self, **kwargs): super(ToxicityConfig, self).__init__(version=VERSION, **kwargs) self.features = features_per_config[kwargs["name"]] class Toxicity(datasets.GeneratorBasedBuilder): # dataset versions DEFAULT_CONFIG = "toxicity" BUILDER_CONFIGS = [ ToxicityConfig(name="toxicity", description="Toxicity for binary classification.") ] def _info(self): if self.config.name not in features_per_config: raise ValueError(f"Unknown configuration: {self.config.name}") info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE, features=features_per_config[self.config.name]) return info def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]: downloads = dl_manager.download_and_extract(urls_per_split) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}) ] def _generate_examples(self, filepath: str): data = pandas.read_csv(filepath).infer_objects() data = data.rename(columns={"Class": "is_toxic"}) data = self.preprocess(data, config=self.config.name) for row_id, row in data.iterrows(): data_row = dict(row) yield row_id, data_row def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame: data.loc[:, "is_toxic"] = data["is_toxic"].apply(lambda x: 1 if x == "Toxic" else 0) return data