# RapidMiner: An Easy Alternative to Coding in Python

**Key takeaways**

- RapidMiner builds a model as a **process**: operators connected by ports, where data flows from left to right, just like a scikit-learn pipeline drawn as boxes.
- The most important design question is **where each step sits**. Preprocessing such as Normalize must sit *inside* cross-validation, so the test folds never influence training.
- One process can train and compare many models fairly, using the same data, the same folds and the same random seed.

---

## 1\. Processes, operators and ports

A RapidMiner process is a chain of **operators**. Each operator does one job and has input and output ports. Some operators, such as Cross Validation, contain **subprocesses** (for example a training side and a testing side). In our group project we grouped the preparation steps into one subprocess so the main process stayed readable.

The basic flow of our heart-disease project:

```text
Retrieve data → Prepare (missing values, label, encoding) → Multiply
   → [Cross Validation: train model | Apply Model → Performance]  × 7 models
```

## 2\. Preparing the data

| Operator | What it does | How we used it |
| --- | --- | --- |
| **Retrieve** | Loads a dataset from the repository | The Cleveland heart disease data |
| **Declare Missing Value** | Marks a placeholder (such as "?") as missing | Missing values in `ca` and `thal` |
| **Filter Examples** | Keeps only rows that meet a condition | Removed rows where `ca` or `thal` was missing (303 → 297 rows) |
| **Generate Attributes** | Creates a new column from an expression | `disease = if(num > 0, 1, 0)`: turned the 0–4 severity score into yes/no |
| **Select Attributes** | Keeps or drops columns | Dropped the original `num` column so the answer could not leak into the features |
| **Set Role** | Tells RapidMiner which column is the **label** (target) | `disease` as label |
| **Numerical to Binominal** | Turns 0/1 numbers into a two-class label | Made `disease` a classification target |
| **Numerical to Polynominal** | Treats number codes as categories | Chest-pain type, slope, sex and other coded columns |
| **Remove Unused Values** | Drops category values no row uses any more | Removed the leftover "?" category from `ca` and `thal` |
| **Nominal to Numerical** (dummy coding) | One-hot encoding | The eight categorical columns became 0/1 columns |
| **Normalize** (Z-transformation) | Scales each feature to mean 0, standard deviation 1 | The five continuous columns (age, blood pressure, cholesterol, max heart rate, ST depression), for distance-based k-NN |

**Lesson:** RapidMiner separates the *type* of a column (numerical, binominal, polynominal) from its *role* (regular attribute or label). A label needs both the right role and the right type (binominal for yes/no) before a classifier will accept it.

<img src="https://cdn.hashnode.com/uploads/covers/6b0f76a874eff5c1bf91b426/36f93d93-cc99-4839-99e5-adb1275e6b41.png" alt="" width="620" height="272" />

## 3\. Training and evaluating

- **Multiply**: copies the prepared data so the same data can feed several models side by side.
- **Cross Validation** (10 folds, local random seed 1992): splits the data into 10 parts, trains on 9 and tests on 1, ten times. The fixed seed makes the folds the same for every model, so the comparison is fair and repeatable.
- **Apply Model**: uses a trained model (or a preprocessing model such as Normalize) on new data.
- **Performance (Binominal Classification)**: reports accuracy, precision, recall, F1 and the confusion matrix for a yes/no label.
- **Split Data**: an earlier version of our process used a simple 70/30 train–test split. We moved to cross-validation because, with under 300 patients, one split gives a noisy result.

<img src="https://cdn.hashnode.com/uploads/covers/6b0f76a874eff5c1bf91b426/54397e11-0743-4710-be8d-bdf28aebdb4c.png" alt="" width="624" height="729" />

## 4\. Tuning: Optimize Parameters (Grid)

**Optimize Parameters (Grid)** wraps a process and tries every value in a grid. We searched k for k-NN from 1 to 21 in 10 steps, with the full cross-validation inside, so each k was judged on unseen folds.

**Normalize inside the folds.** In our updated process, Normalize sits *inside* the training side of cross-validation. It learns the mean and standard deviation from the training folds only, and Apply Model reuses those values on the test fold. Normalising the whole dataset first would leak information from the test data into training.

<img src="https://cdn.hashnode.com/uploads/covers/6b0f76a874eff5c1bf91b426/d0decb9c-f13b-4db0-b1b7-0029a4399d2d.png" alt="" width="624" height="167" />

## 5\. The models we compared

| Model | Settings we used |
| --- | --- |
| k-NN | k from the grid search, weighted vote, Euclidean distance |
| Decision Tree | information gain, maximal depth 10 |
| Logistic Regression (H2O) | no regularisation |
| Random Forest | 20 trees, information gain, depth 15 |
| Bagging | 20 decision trees, each on a 70% sample |
| AdaBoost | 21 boosting rounds of decision trees |
| Gradient Boosted Trees (H2O) | 50 trees, depth 5, learning rate 0.01 |

**What we found:** Logistic Regression was the most reliable (accuracy 0.829, F1 0.811), k-NN was the weakest (0.644), and every ensemble beat a single decision tree by about 5–9 accuracy points.

**Decision-tree criteria.** Information gain picks the split that reduces uncertainty the most. Gain ratio corrects it for attributes with many values, which information gain tends to favour.

<img src="https://cdn.hashnode.com/uploads/covers/6b0f76a874eff5c1bf91b426/7a42bd68-745e-4e26-9664-fbd62642e524.png" alt="" width="624" height="315" />

## 6\. Neural networks in RapidMiner (lab)

In a lab on the sonar dataset (60 readings per sample, labelled rock or mine), I built a **Neural Net** with 60 input neurons and 2 output classes. A **Normalize** operator came first, because neural networks train badly when features have very different ranges.

## 7\. RapidMiner vs Python: what I took from using both

|  | RapidMiner | Python (scikit-learn) |
| --- | --- | --- |
| Building | Drag and connect operators | Write code |
| Seeing the flow | The process is a picture | Must read the code |
| Avoiding leakage | Put Normalize inside Cross Validation | Put the scaler inside a Pipeline |
| Repeatability | Local random seed on each operator | `random_state` |
| Best for | Fast experiments and explaining a process to others | Full control, automation, production |

The same ideas carried over in both tools: prepare the data carefully, keep the test data unseen, fix the random seed, and compare models on the same folds. Both tools also gave the same conclusion in our project: Logistic Regression won.

---

**Skills demonstrated:** RapidMiner · visual ML pipelines · data preparation (missing values, label roles, dummy coding, Z-normalisation) · 10-fold cross-validation · grid search · k-NN · decision trees · logistic regression · random forest · bagging · AdaBoost · gradient boosted trees · neural networks · model evaluation (accuracy, precision, recall, F1, confusion matrix)

*The Hybrid Mind: where symbolic AI meets neural networks.*
