PeaBox Lab › PeaLang › Learn › Chapter 19

Part IV — Expert Production Engineering · Chapter 19

Machine-Learning Foundations

Chapter 18 forecast the future of a single quantity from its own history. Many business questions have a different shape: given what we know about a customer, an invoice, or a support case, what value or category should we predict? Will this customer churn? Is this claim likely to be fraudulent? How many hours will this job take? Supervised machine learning answers such questions by learning a mapping from features to a target using labelled historical examples.

This chapter builds the foundations that every later model rests on: honest data splitting and preprocessing; two interpretable model families, linear and logistic regression; metrics that match business cost; cross-validation and regularization for choosing models; multiclass problems, calibrated probabilities, and decision thresholds; and finally pipelines that bundle preprocessing and model into one reproducible, schema-checked artifact. Chapter 20 then governs, signs, and monitors those artifacts in production.

Release note. In v0.63 the ML layer is exposed mainly through the Python host package, and the installation also registers a pea-ml command-line entry point. Listings in this chapter are marked illustrative: they teach the operations and their contracts with readable names. Confirm exact module paths, class names, and arguments in the module reference of your installed version (pea --version) before copying a listing into production code. The built-in methods are foundations, not proof that a model is appropriate; domain validation, governance, and monitoring remain mandatory.