code: def load_dataset(
      dataset_name, balance=False, discretize=True, dataset_folder="./"
  ):
      if dataset_name == "adult":
          feature_names = [
              "Age",
              "Workclass",
              "fnlwgt",
              "Education",
              "Education-Num",
              "Marital Status",
              "Occupation",
              "Relationship",
              "Race",
              "Sex",
              "Capital Gain",
              "Capital Loss",
              "Hours per week",
              "Country",
              "Income",
          ]
          features_to_use = [0, 1, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13]
          categorical_features = [1, 3, 5, 6, 7, 8, 9, 10, 11, 13]
          education_map = {
              "10th": "Dropout",
              "11th": "Dropout",
              "12th": "Dropout",
              "1st-4th": "Dropout",
              "5th-6th": "Dropout",
              "7th-8th": "Dropout",
              "9th": "Dropout",
              "Preschool": "Dropout",
              "HS-grad": "High School grad",
              "Some-college": "High School grad",
              "Masters": "Masters",
              "Prof-school": "Prof-School",
              "Assoc-acdm": "Associates",
              "Assoc-voc": "Associates",
          }
          occupation_map = {
              "Adm-clerical": "Admin",
              "Armed-Forces": "Military",
              "Craft-repair": "Blue-Collar",
              "Exec-managerial": "White-Collar",
              "Farming-fishing": "Blue-Collar",
              "Handlers-cleaners": "Blue-Collar",
              "Machine-op-inspct": "Blue-Collar",
              "Other-service": "Service",
              "Priv-house-serv": "Service",
              "Prof-specialty": "Professional",
              "Protective-serv": "Other",
              "Sales": "Sales",
              "Tech-support": "Other",
              "Transport-moving": "Blue-Collar",
          }
          country_map = {
              "Cambodia": "SE-Asia",
              "Canada": "British-Commonwealth",
              "China": "China",
              "Columbia": "South-America",
              "Cuba": "Other",
              "Dominican-Republic": "Latin-America",
              "Ecuador": "South-America",
              "El-Salvador": "South-America",
              "England": "British-Commonwealth",
              "France": "Euro_1",
              "Germany": "Euro_1",
              "Greece": "Euro_2",
              "Guatemala": "Latin-America",
              "Haiti": "Latin-America",
              "Holand-Netherlands": "Euro_1",
              "Honduras": "Latin-America",
              "Hong": "China",
              "Hungary": "Euro_2",
              "India": "British-Commonwealth",
              "Iran": "Other",
              "Ireland": "British-Commonwealth",
              "Italy": "Euro_1",
              "Jamaica": "Latin-America",
              "Japan": "Other",
              "Laos": "SE-Asia",
              "Mexico": "Latin-America",
              "Nicaragua": "Latin-America",
              "Outlying-US(Guam-USVI-etc)": "Latin-America",
              "Peru": "South-America",
              "Philippines": "SE-Asia",
              "Poland": "Euro_2",
              "Portugal": "Euro_2",
              "Puerto-Rico": "Latin-America",
              "Scotland": "British-Commonwealth",
              "South": "Euro_2",
              "Taiwan": "China",
              "Thailand": "SE-Asia",
              "Trinadad&Tobago": "Latin-America",
              "United-States": "United-States",
              "Vietnam": "SE-Asia",
          }
          married_map = {
              "Never-married": "Never-Married",
              "Married-AF-spouse": "Married",
              "Married-civ-spouse": "Married",
              "Married-spouse-absent": "Separated",
              "Separated": "Separated",
              "Divorced": "Separated",
              "Widowed": "Widowed",
          }
          label_map = {
              "<=50K": "Less than $50,000",
              ">50K": "More than $50,000",
          }
  
          def cap_gains_fn(x):
              x = x.astype(float)
              d = np.digitize(
                  x, [0, np.median(x[x > 0]), float("inf")], right=True
              ).astype("|S128")
              return map_array_values(
                  d, {"0": "None", "1": "Low", "2": "High"}
              )
  
          transformations = {
              3: lambda x: map_array_values(x, education_map),
              5: lambda x: map_array_values(x, married_map),
              6: lambda x: map_array_values(x, occupation_map),
              10: cap_gains_fn,
              11: cap_gains_fn,
              13: lambda x: map_array_values(x, country_map),
              14: lambda x: map_array_values(x, label_map),
          }
          dataset = load_csv_dataset(
              os.path.join(dataset_folder, "adult/adult.data"),
              -1,
              ", ",
              feature_names=feature_names,
              features_to_use=features_to_use,
              categorical_features=categorical_features,
              discretize=discretize,
              balance=balance,
              feature_transformations=transformations,
          )
      elif dataset_name == "diabetes":
          categorical_features = [
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              10,
              11,
              18,
              19,
              20,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38,
              39,
              40,
              41,
              42,
              43,
              44,
              45,
              46,
              47,
              48,
          ]
          label_map = {"<30": "YES", ">30": "YES"}
          transformations = {
              49: lambda x: map_array_values(x, label_map),
          }
          dataset = load_csv_dataset(
              os.path.join(
                  dataset_folder, "diabetes/diabetic_data.csv"
              ),
              -1,
              ",",
              features_to_use=range(2, 49),
              categorical_features=categorical_features,
              discretize=discretize,
              balance=balance,
              feature_transformations=transformations,
          )
      elif dataset_name == "default":
          categorical_features = [2, 3, 4, 6, 7, 8, 9, 10, 11]
          dataset = load_csv_dataset(
              os.path.join(dataset_folder, "default/default.csv"),
              -1,
              ",",
              features_to_use=range(1, 24),
              categorical_features=categorical_features,
              discretize=discretize,
              balance=balance,
          )
      elif dataset_name == "recidivism":
          features_to_use = [
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
          ]
          feature_names = [
              "Race",
              "Alcohol",
              "Junky",
              "Supervised Release",
              "Married",
              "Felony",
              "WorkRelease",
              "Crime against Property",
              "Crime against Person",
              "Gender",
              "Priors",
              "YearsSchool",
              "PrisonViolations",
              "Age",
              "MonthsServed",
              "",
              "Recidivism",
          ]
  
          def violations_fn(x):
              x = x.astype(float)
              d = np.digitize(
                  x, [0, 5, float("inf")], right=True
              ).astype("|S128")
              return map_array_values(
                  d, {"0": "NO", "1": "1 to 5", "2": "More than 5"}
              )
  
          def priors_fn(x):
              x = x.astype(float)
              d = np.digitize(
                  x, [-1, 0, 5, float("inf")], right=True
              ).astype("|S128")
              return map_array_values(
                  d,
                  {
                      "0": "UNKNOWN",
                      "1": "NO",
                      "2": "1 to 5",
                      "3": "More than 5",
                  },
              )
  
          transformations = {
              0: lambda x: replace_binary_values(x, ["Black", "White"]),
              1: lambda x: replace_binary_values(x, ["No", "Yes"]),
              2: lambda x: replace_binary_values(x, ["No", "Yes"]),
              3: lambda x: replace_binary_values(x, ["No", "Yes"]),
              4: lambda x: replace_binary_values(x, ["No", "Married"]),
              5: lambda x: replace_binary_values(x, ["No", "Yes"]),
              6: lambda x: replace_binary_values(x, ["No", "Yes"]),
              7: lambda x: replace_binary_values(x, ["No", "Yes"]),
              8: lambda x: replace_binary_values(x, ["No", "Yes"]),
              9: lambda x: replace_binary_values(x, ["Female", "Male"]),
              10: lambda x: priors_fn(x),
              12: lambda x: violations_fn(x),
              13: lambda x: (x.astype(float) / 12).astype(int),
              16: lambda x: replace_binary_values(
                  x, ["No more crimes", "Re-arrested"]
              ),
          }
  
          dataset = load_csv_dataset(
              os.path.join(dataset_folder, "recidivism/Data_1980.csv"),
              16,
              feature_names=feature_names,
              discretize=discretize,
              features_to_use=features_to_use,
              balance=balance,
              feature_transformations=transformations,
              skip_first=True,
          )
      elif dataset_name == "lending":
  
          def filter_fn(data):
              to_remove = [
                  "Does not meet the credit policy. Status:Charged Off",
                  "Does not meet the credit policy. Status:Fully Paid",
                  "In Grace Period",
                  "-999",
                  "Current",
              ]
              for x in to_remove:
                  data = data[data[:, 16] != x]
              return data
  
          bad_statuses = set(
              [
                  "Late (16-30 days)",
                  "Late (31-120 days)",
                  "Default",
                  "Charged Off",
              ]
          )
          transformations = {
              16: lambda x: np.array(
                  [y in bad_statuses for y in x]
              ).astype(int),
              19: lambda x: np.array([len(y) for y in x]).astype(int),
              6: lambda x: np.array(
                  [y.strip("%") if y else -1 for y in x]
              ).astype(float),
              35: lambda x: np.array(
                  [y.strip("%") if y else -1 for y in x]
              ).astype(float),
          }
          features_to_use = [2, 12, 13, 19, 29, 35, 51, 52, 109]
          categorical_features = [12, 109]
          dataset = load_csv_dataset(
              os.path.join(
                  dataset_folder, "lendingclub/LoanStats3a_securev1.csv"
              ),
              16,
              ",",
              features_to_use=features_to_use,
              feature_transformations=transformations,
              fill_na="-999",
              categorical_features=categorical_features,
              discretize=discretize,
              filter_fn=filter_fn,
              balance=True,
          )
          dataset.class_names = ["Good Loan", "Bad Loan"]
  
      return dataset
  
file_path: anchor/anchor/utils.py
imports: import copy
  import sklearn
  import numpy
  import lime
  import lime.lime_tabular
  import os
  import sys
label_desc: Use image node_id 3 for calling a global function with example usage: load_dataset(dataset_name, balance, discretize, dataset_folder) and returns: dataset, map_array_values, map_array_values, map_array_values, data