Skip to content

    Feature Engineering & Scaling

    Machine Learning · Intermediate

    Definition

    Feature engineering creates and transforms inputs so models learn patterns better.

    Good features often matter more than the choice of model.

    Diagram

    raw datacleanencodescalemodel

    Flowchart

    Handle missing valuesEncode categoriesScale numbersCreate new featuresRemove leaks

    Example: Min-max scaling

    x = [10, 20, 30]
    lo, hi = min(x), max(x)
    print([(v - lo) / (hi - lo) for v in x])

    Output: [0.0, 0.5, 1.0]

    Key points

    • Fit scalers on training data only
    • One-hot encode nominal categories

    Interview questions

    Standardization formula?

    z = (x − mean) / std.

    More Machine Learning topics