Feature Engineering

هندسة الميزات

Definition

Designing, transforming and selecting a model's input variables from raw data to improve its performance.

Definition

Feature engineering is the process of using domain knowledge to create, transform and select input variables from raw data so that machine learning models perform better.

Practical examples

Code example Python
import pandas as pd

df = pd.DataFrame({"city": ["Baghdad", "Basra", "Baghdad"], "age": [20, 30, 40]})
df = pd.get_dummies(df, columns=["city"], dtype=int)
df["age_z"] = (df["age"] - df["age"].mean()) / df["age"].std(ddof=0)
print(df.round(3).to_string(index=False))

Expected output

 age  city_Baghdad  city_Basra  age_z
  20             1           0 -1.225
  30             0           1  0.000
  40             1           0  1.225

Mathematical equations

z = \frac{x - \mu}{\sigma}

Scientific sources

References and scientific sources

Learn and review

Suggested terms to learn next