How to Clean Data (RapidMiner)

Updated 14 Oct 2026

How to Clean Data: Step-by-Step (+ RapidMiner operator)

Order: profile → structure → type → standardize → range → missing → outliers → duplicates → integrate → transform → re-check.
Each step needs the step before it: you can't range-check "abc", and you can't dedupe " milk " vs "Milk" until both are standardized.
(Operators marked † weren't used in our homework, but they exist in AI Studio.)

#StepWhat to doLecture checkRapidMiner
0Know your dataLook at types, min/max, missing counts, distinct values, skew—Results → Statistics tab, histograms, Breakpoint After
1StructureWrong number of fields (missing or extra comma) → quarantine, don't guessPresenceRead CSV (Import Wizard shows broken rows), Filter Examples
2TypeText in a number field ("abc") → treat as missingTypeSet types in the Read CSV wizard; Numerical to Polynominal / Nominal to Numerical
3StandardizeOne format per field: " milk "→MILK, M/Male→M, one date format, one unitFormatMap, Replace†, Trim†, Generate Attributes (unit conversion), Rename
4Range / rulesImpossible values (qty ≤ 0, price > max, GPS (0,0), 31 Sept) → remove or set missing. Turn sentinels (-1, -99999, N/A) into missingRangeFilter Examples (custom filter, e.g. lat ≠ 0)
5MissingChoose a fill using the table belowPresenceReplace Missing Values; Filter Examples → no_missing_attributes
6OutliersDetect, then decide: noise → remove; valid → keepRangeDetect Outlier (Distances) → Filter Examples (outlier = false)
7DuplicatesSame record or same key twice → keep one (only after step 3)Cross-recordRemove Duplicates†; or Aggregate by the key
8IntegrateCombine sources; fix column-name mismatches (cust_id = cust_no) and the same entity with different names—Join (lookup table), Append (stack same columns), Rename
9TransformScale, bin, aggregate, keep useful columns only—Normalize, Discretize, Aggregate, Pivot, Select Attributes, Sample, Set Role
10Re-checkRun every validation check again; row counts before vs afterAllStatistics tab, Breakpoint

Missing values: what to fill with?

SituationFill withWhy
The label (target) is missingDrop the rowUseless for training ("ignore the tuple")
Missing means "none happened" (0 pings in an hour, no purchase)00 is the true value (HW2: Pivot → Replace Missing = 0 → X-Means)
Numeric, symmetric (height, temperature)MeanKeeps the average
Numeric, skewed or with outliers (income, price)MedianThe mean gets dragged by outliers. If mean > median, use the median
Categorical (color, occupation)Mode or a new class "Unknown"You can't average categories
Rows fall into classesMean/median of the same class"Smarter": similar rows are alike
Time series (GPS, prices, sensors)Forward / backward fillYesterday's price is the best guess for today
Other columns can predict itKNN / regression / most probable valueUses similar rows
A money or transaction fact (qty, amount)Drop or verify, never imputeImputing invents sales that never happened
Most of the column is emptyDrop the columnToo little signal to fill honestly
Only a few rows, lots of dataListwise deletion (drop the rows)Cheap, little bias
Keep rows, use what's therePairwise deletionLoses less data

When 0 is wrong: when 0 is a real, different value. A missing temperature ≠ 0 °C, a missing salary ≠ 0 THB, a missing age ≠ age 0.

In RapidMiner: Replace Missing Values offers average / minimum / maximum / zero / value (put the median or mode in yourself as a value). To drop missing rows, use Filter Examples → no_missing_attributes.

Quick flow: label? → drop · means none? → 0 · money fact? → drop/verify · time series? → ffill · category? → mode/Unknown · skewed? → median · symmetric? → mean · mostly empty? → drop the column


Outliers: valid or noise?

Detect: Z-score (|z| > 3), IQR (outside Q1 − 1.5·IQR / Q3 + 1.5·IQR), boxplot, clustering / DBSCAN, Detect Outlier (Distances).

TypeExampleActionRapidMiner
Noise (impossible, breaks a rule)age 200, salary −10, price 4,000 when the max is 1,000, GPS (0,0)RemoveDetect Outlier → Filter Examples
Valid (rare but real)CEO salary, a 500-snack school orderKeep, reduce its effect: robust scaling, log, cappingNormalize (Z), Discretize
Unsurea sudden spikeFlag and verify with the sourceKeep the outlier column, don't filter

Smooth noise instead of deleting it: moving average, bin means (equal frequency), low-pass filter.
Lesson from HW2 Ex3: removing outliers changed accuracy only 73.63% → 73.85%, so measure the effect; don't assume cleaning always helps.


Transform: which one?

NeedUseRapidMiner
Scale to [0, 1]Min-max (sensitive to outliers)Normalize → range transformation
Mean 0, std 1Z-scoreNormalize → Z-transformation
Skewed dataLog transform / robust (median, IQR) scalingGenerate Attributes (log(x))
BinsEqual width (outliers dominate) / equal frequencyDiscretize by Binning / by Frequency
One row per entityGroup-by / long → wideAggregate / Pivot
Less dataSampling (stratified if skewed), feature selectionSample (Stratified), Select Attributes, Weight by SVM → Select by Weights

What counts as "clean"?

  • ☐ Validation passes: presence, type, length, range, format
  • ☐ Verification passes: values match business rules and real records
  • ☐ No unexplained missing values: every fill has a reason, or the row/column was dropped
  • ☐ No sentinels left (-1, -99999, 0,0, N/A)
  • ☐ Consistent: one format, one unit, one spelling per category
  • ☐ No duplicates (by key)
  • ☐ Outliers decided: noise removed, valid ones kept
  • ☐ Totals reconcile: rows before vs after, sums match the source
  • ☐ Documented: what was dropped and why (keep the rejected rows)

These map to the Data Quality dimensions (Lecture 3): Accuracy, Completeness, Consistency, Timeliness, Believability, Interpretability.

In MapReduce: per-record checks (structure, type, standardize, range) go in the mapper. Duplicates and a global mean for imputation need the reducer or another job, because a mapper sees only one record at a time.