Most models only understand numbers, but real data is full of categories: city, plan tier, device type. Encoding converts those categories into numeric columns — and the method you pick changes what the model can learn from them.
Note
The Three Main Methods
| Method | What it does |
|---|---|
| One-hot | One 0/1 column per category — no false order |
| Label | Each category → an integer — implies an order |
| Target | Category → its mean target value — powerful but leaks easily |
One-hot, shown in the diagram above, is the safe default for nominal categories — it never implies that C is greater than A.
When Each Fits
- One-hot: nominal categories with few distinct values
- Label: genuinely ordinal categories (small < medium < large)
- Target: high-cardinality features — but only with careful cross-validation
Watch out
The High-Cardinality Trap
One-hot encoding a column with hundreds of categories explodes it into hundreds of sparse columns. For high-cardinality features, group rare categories into "other," or use target encoding — carefully, because it can leak the answer.
Watch out
Encoding in the SKARI Data Editor
The Data Editor's encoding tool converts categorical columns without code: pick a column and a method, preview the new columns, and apply it as a tracked step in your preprocessing pipeline.
- One-hot and label encoding on any categorical column
- A preview of the resulting columns before you commit
- Every step recorded in the pipeline history, so it's reproducible
Takeaway
Frequently Asked Questions
One-hot or label?
One-hot for nominal categories; label only when the categories have a real order.
Do tree models need one-hot?
Less so — trees can split on label-encoded values, but one-hot is still safer for nominal data and required for linear models.
When is target encoding worth it?
For high-cardinality features where one-hot explodes — but only computed within cross-validation to avoid leakage.
Conclusion
Encoding is where text becomes something a model can learn from. Match the method to the category type, watch cardinality, and guard against leakage — and your features carry real signal, not a fabricated order.
Takeaway
Feature Engineering
What to build once it's numeric
Data Normalization
Scaling the numbers you just made
Cross-Validation
Where target encoding must live