Skip to content
Minsing Log
Go back

English Edition

Data preprocessing

Data & ML

Data preprocessing

Role of data preprocessing

  1. Data transformation (feature engineering) into a form suitable for use as machine learning input -> To train the model, the data must be transformed into appropriate numerical data.

  2. Handling NAN/NULL (missing values) and outliers for data cleaning -> Transforming the data into a form suitable for model training / the items above cannot be used for training

  3. Train-test split


Methods for handling categorical variables

Nominal data (norminal data)

Ordinal data

• Converted by mapping to numerical values, but the differences in magnitude between numerical values can be customized

• The differences in magnitude can affect machine learning results


Methods for handling numerical variables

Can be used directly as input values, but transformation is necessary to improve model performance

1) Scaling

Normalization

Standardization

2) Categorization


Missing value handling

Methods

  1. Delete samples containing NAN values
  2. Delete features containing many missing values
  3. Replace with other values (mean/median/SimpleImputer/machine learning)

Outlier handling

Methods for determining outliers

  1. Use statistical indicators (chi-square test, IQR indicator, etc.)
  2. Examine the data distribution and determine them directly
  3. Use machine learning techniques to classify outliers

Train-test split

cf) Train-test split parameters

  1. random_state: When shuffling the sets, they are shuffled according to the given int value. When tuning hyperparameters, this value should be kept fixed to prevent the dataset from changing each time.

  2. stratify: The default is None. This is a very important option when working with classification. If the stratify value is set to target, the ratio of each class is maintained in the train / validation sets. (This prevents the data from being distributed disproportionately to one side.) If this option is not specified when handling a classification problem, there may be a significant difference in performance.

  3. test_size: Indicates the proportion of the test set. It is an option value opposite to the train_size option, and test_size is usually specified. 0.2 means that 20% of the entire dataset will be designated as the test (validation) set. The default value is 0.25.




공개 여정 구독

글이 올라오면 이메일로 보내드릴게요.

개발, 창업, 배움, 실패와 회고를 짧고 솔직하게 기록합니다. 검색으로 스쳐가는 독자가 아니라 여정을 따라오는 팬을 만들기 위한 뉴스레터입니다.

뉴스레터는 준비 중입니다. 그동안 RSS 로 구독하거나 이메일 로 알림을 요청해 주세요.


Share this post:

Comments

Sign in with GitHub to leave a comment.


Previous Post
Supervised Learning (Regression)
Next Post
Forms of Data