Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
11 posts found
What Is Machine Learning and When Do You Need It? Choosing Between Rules, ML and LLMs
Artificial Intelligence PART 01

What Is Machine Learning and When Do You Need It? Choosing Between Rules, ML and LLMs

Machine learning is a function learned from past data instead of rules you write by hand; it pays off when you have labeled data and a measurable goal. We measure a hand-written delivery-time rule for Bookstore on seeded synthetic data, map the problem types (regression, classification, clustering, anomaly detection) to Bookstore examples and discuss when to pick classical ML, deep learning or an LLM.

15 Nov 2026 11 min 6
Data and Features: Datasets, Labels, Feature Types and Data Quality
Artificial Intelligence PART 02

Data and Features: Datasets, Labels, Feature Types and Data Quality

Everything a model can learn lives in rows, features and the label, so the first job is to look at the data, not the model. In Bookstore's synthetic order export we use Microsoft.Data.Analysis and LINQ to find 104 duplicate orders, 62 spellings of 16 cities, totals stored in kuruş, negative labels and mislabeled reviews, then discuss cleaning decisions and keeping personal data out of training.

15 Nov 2026 13 min 7
Train/Test Splits, Overfitting and Data Leakage: Why a Model Shines in Tests and Fails in Production
Artificial Intelligence PART 03

Train/Test Splits, Overfitting and Data Leakage: Why a Model Shines in Tests and Fails in Production

A test score lies unless the model is measured on data it has not seen, using only information that will really be available at prediction time. On Bookstore's delivery-time data we use ML.NET to show baselines, the overfitting curve, the fake success created by a column that only exists after delivery and by a feature computed on all rows, the carrier slowdown that a time-based split catches, samplingKeyColumnName and cross-validation, all with real measurements.

15 Nov 2026 15 min 4
Your First ML.NET Model: MLContext, IDataView, Pipelines and Predicting Delivery Time
Artificial Intelligence PART 04

Your First ML.NET Model: MLContext, IDataView, Pipelines and Predicting Delivery Time

An ML.NET model is a chain of estimators built on MLContext that learns from training data with Fit; the result is a single transformer you can save and load. For Bookstore's delivery time we cover the input class, the lazy IDataView, the trap of empty cells being read as 0 by default, the first SDCA regression model, single predictions with PredictionEngine, saving the model as a .zip, and float/double, column name and thread-safety errors, all with real output.

15 Nov 2026 13 min 6
Feature Engineering: Normalization, One-Hot Encoding, Text Featurization and Missing Values
Artificial Intelligence PART 05

Feature Engineering: Normalization, One-Hot Encoding, Text Featurization and Missing Values

Feature engineering turns raw columns into numbers a model can use and carries business knowledge into those numbers; for Bookstore's delivery time the biggest gain came from a single domain feature derived from the order time, not from the algorithm. We show with cross-validation how normalization rescues SDCA, one-hot versus hashing, date features with CustomMapping, FeaturizeText, missing values and training-serving skew.

15 Nov 2026 14 min 8
Regression and Its Metrics: Linear Regression, Gradient Boosting, MAE, RMSE and R²
Artificial Intelligence PART 06

Regression and Its Metrics: Linear Regression, Gradient Boosting, MAE, RMSE and R²

Regression predicts a number; choosing the right metric matters as much as choosing the algorithm, because MAE measures average deviation, RMSE punishes large errors and R² measures explained variance. We write gradient descent by hand in C#, compare SDCA, FastTree, FastForest and LightGBM on Bookstore's delivery time, and show with real output how 21 lost parcels nearly triple RMSE, how residual analysis works and how two model families behave outside the training range.

15 Nov 2026 14 min 7
Classification and Its Metrics: Confusion Matrix, Precision, Recall, F1 and ROC-AUC
Artificial Intelligence PART 07

Classification and Its Metrics: Confusion Matrix, Precision, Recall, F1 and ROC-AUC

On imbalanced data accuracy misleads; a classification model has to be measured with precision, recall, PR-AUC and a threshold chosen from business costs. We predict Bookstore's order cancellation risk with logistic regression and FastTree and show with real output how 95.8% accuracy catches no cancellation at all, how to pick the threshold by cost on a validation set, how to check calibration, and a multiclass model that predicts the topic of a review.

15 Nov 2026 16 min 6
Unsupervised Learning: Customer Segmentation with K-Means and Sales Anomaly Detection
Artificial Intelligence PART 08

Unsupervised Learning: Customer Segmentation with K-Means and Sales Anomaly Detection

Without labels a model finds structure, not the right answer; the value of k-means and anomaly detection is measured by whether their results mean something to the business. We segment Bookstore's customers with k-means on RFM features and show with real output the effect of scaling, choosing k and stability across seeds, and how ML.NET's three anomaly detectors separate campaigns, an outage and a pricing error in the daily order series.

15 Nov 2026 15 min 8
Model Selection and AutoML: Hyperparameters, Cross-Validation, the AutoML API and Feature Importance
Artificial Intelligence PART 09

Model Selection and AutoML: Hyperparameters, Cross-Validation, the AutoML API and Feature Importance

Hyperparameter search and AutoML speed up model selection when the metric is right and the data has no leakage, but they cannot strengthen a weak signal. On Bookstore's cancellation risk we compare grid and random search for FastTree with cross-validation, the ML.NET AutoML API and the mlnet CLI that searches by accuracy, and show with real output how a leaky column produces an AUC of 1.0, Permutation Feature Importance and a fairness check by age and district.

15 Nov 2026 15 min 7
Taking a Model to Production: PredictionEnginePool in ASP.NET Core, Model Versioning and Drift
Artificial Intelligence PART 10

Taking a Model to Production: PredictionEnginePool in ASP.NET Core, Model Versioning and Drift

The way to serve an ML.NET model safely in ASP.NET Core is PredictionEnginePool, a card stored with the model and drift tracked against real outcomes. We put Bookstore's delivery-time model into a minimal API and show with real output how a shared PredictionEngine returns 12% wrong answers under load, how to update the model without a restart, latency metrics, and a model that degrades while its inputs stay the same.

15 Nov 2026 17 min 7
Bridging to Python: Solving the Same Problem with scikit-learn and Running It in .NET via ONNX
Artificial Intelligence PART 11

Bridging to Python: Solving the Same Problem with scikit-learn and Running It in .NET via ONNX

A model trained with scikit-learn in Python can be converted to ONNX together with its preprocessing and run in .NET with ONNX Runtime so that it gives the same result. We build Bookstore's cancellation model with a scikit-learn Pipeline and cross-validation, map the concepts to ML.NET, export it with skl2onnx and score it in C#, showing with real output that the difference stays around 10⁻⁷, and the float type, opset and unconvertible step pitfalls.

15 Nov 2026 11 min 5
Blog Map