<jupyter_start><jupyter_text>Tutorial: Data preprocessing<jupyter_code>%load_ext autoreload
%autoreload 2
import numpy as np
import pandas as pd<jupyter_output><empty_output><jupyter_text>Load UCI DataUCI Adult data are going to be used in this tutorial. The data contain both numerical and categorical features, and the target to predict is whether a person makes over 50K a year. It is a very simple binary classification task.<jupyter_code>train = pd.read_csv('kuma_utils/datasets/adult_train.csv')
test = pd.read_csv('kuma_utils/datasets/adult_test.csv')
train.head()
test.head()
from kuma_utils.visualization import explore_data
explore_data(train, test, exclude_columns=[])<jupyter_output>data shape: (32561, 15), (16281, 15)

Included columns: 
['Target', 'Occupation', 'Sex', 'Relationship', 'Martial_Status', 'Age',
 'Education', 'Race', 'Capital_Loss', 'fnlwgt', 'Workclass', 'Capital_Gain',
 'Hours_per_week', 'Country', 'Education_Num'] (15)

  0 Target: 

 n_classes=2
          train      test
 <=50K  0.75919  0.763774
 >50K   0.24081  0.236226

  1 Occupation: 

 n_classes=15
                       train      test
 Prof-specialty     0.127146  0.124808
 Craft-repair       0.125887  0.123641
 Exec-managerial    0.124873  0.124071
 Adm-clerical       0.115783  0.113077
 Sales              0.112097  0.113875
 Other-service      0.101195  0.099994
 Machine-op-inspct  0.061485  0.062650
NaN                 0.056601  0.059333
 Transport-moving   0.049046  0.046557
 Handlers-cleaners  0.042075  0.043118
 Farming-fishing    0.030527  0.030465
 Tech-support       0.028500  0.031816
 Protective-serv    0.019932  0.020515
 Priv-house-serv    0.004576  0.005712
 Armed-Forces    [...]
{'fraction_non_alphanumeric': 0.10058823529411764, 'fraction_numerical': 0.14705882352941177, 'mean_word_length': 3.406735751295337, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '159347', 'license': 'MIT', 'n_tokens_mistral': 763, 'n_tokens_neox': 608, 'n_words': 150, 'path': 'examples/Exploratory_data_analysis.ipynb', 'repo_name': 'marketneutral/kuma_utils', 'size': '1700'}