A machine learning project follows a repeatable workflow — from a business question to a deployed, monitored model. Skipping steps (especially evaluation and monitoring) is the most common cause of ML projects that fail in production.
The Standard ML Workflow
| Step | What Happens | Related Notes |
|---|---|---|
| 1. Define the problem | Translate a business question into a supervised/unsupervised ML problem with a measurable target | — |
| 2. Collect data | Gather historical data relevant to the problem | Data Loading |
| 3. Explore & clean | Understand distributions, handle missing values and outliers | EDA, Data Preprocessing |
| 4. Engineer features | Create and select the inputs the model will actually use | Feature Engineering |
| 5. Split the data | Separate into train/validation/test sets so evaluation is honest | Train-Test Split |
| 6. Train models | Fit one or more candidate algorithms on the training set | — |
| 7. Evaluate | Measure performance on held-out data with the right metric | Model Evaluation |
| 8. Tune | Search for better hyperparameters | Hyperparameter Tuning |
| 9. Deploy | Serve the model so it can make real predictions | ML Model Deployment |
| 10. Monitor | Track performance and data drift over time, retrain as needed | MLOps |
A Minimal Version of the Whole Pipeline
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report
from sklearn.datasets import load_breast_cancer
data = load_breast_cancer()
# Step 5: split
X_train, X_test, y_train, y_test = train_test_split(
data.data, data.target, test_size=0.2, random_state=42
)
# Step 6: train
model = RandomForestClassifier(n_estimators=200, random_state=42)
model.fit(X_train, y_train)
# Step 7: evaluate
preds = model.predict(X_test)
print(classification_report(y_test, preds))
This snippet compresses steps 5–7 into a few lines — but in a real project, steps 1–4 (defining the problem, collecting and cleaning data, engineering features) usually take far longer than training the model itself.
Common Mistakes
- Jumping straight to model training without properly exploring the data — this is how data leakage and silently broken features slip through.
- Treating deployment as an afterthought instead of part of the workflow — a model with 99% accuracy that never ships delivers zero business value.
- Skipping monitoring — a model's accuracy degrades over time as real-world data shifts away from the training distribution (model drift).
Interview Relevance
Q: "Walk me through your ML workflow for a new project." A strong answer follows problem definition → data collection/cleaning → feature engineering → train/test split → model training → evaluation → tuning → deployment → monitoring, and explicitly mentions why the split happens before any feature engineering that could leak test-set information.
Practice Question
A colleague scales the entire dataset (including the test set) before splitting into train/test. Explain why this is a mistake and where in the workflow above it should actually happen.