In modern data engineering and artificial intelligence, the key to success lies not simply in the choice of model, but in building a coherent, reproducible and standardised process — a machine learning pipeline. The pipeline brings together all stages of data processing: from loading and pre-processing to final evaluation [1]. Establishing a clear sequence of steps is critical for object identification tasks, as the quality of the input data directly affects the algorithm’s ability to correctly distinguish between classes and minimise errors in real-world conditions.
This paper examines an approach to building a classification pipeline using the classic Iris dataset as an example. This dataset contains information on three species of flowers: Setosa, Versicolor and Virginica, which must be identified on the basis of four geometric features (the length and width of the petals and sepals). The logistic regression algorithm is used as the base classifier within the pipeline architecture. The aim of this paper is to design a machine learning pipeline, implement all stages of feature preparation, and conduct a comprehensive engineering assessment of the model’s performance using a confusion matrix and an extended classification report.
Stages in building a pipeline. The architectural pipeline that has been developed consists of five sequential modules, implemented in software [2]:
• Data Ingestion module. At this stage, structured input features X and the corresponding class labels y were automatically extracted using tools from the sklearn library. модуль завантаження (Data Ingestion).
• Label Encoding module. To ensure the pipeline’s versatility and the ability to work with text-based object names, a label encoding step has been implemented using LabelEncoder, which transforms categories into numerical indices.
• Data Splitting module. To ensure the objectivity of the evaluation, the data is split into a training subset and a test subset in a fixed 80/20.
• Feature scaling module. Using StandardScaler, the data was transformed to a common scale with a mean of 0 and a standard deviation of 1, thereby preventing any single feature from dominating the others.
• Training module. The parameters of the logistic regression classifier were optimised using the trained and scaled data.
The performance of the constructed pipeline was evaluated using test data by comparing the model’s predictions with the reference values. The test results demonstrated the highest level of engineering reliability, as shown in Fig. 1
Figure 1 – Performance evaluation
Analysis of the confusion matrix. The generated matrix clearly indicates the absence of Type I and Type II errors. All instances (10 for class 0, 9 for class 1 and 11 for class 2) are distributed exclusively along the main diagonal, which indicates that the classes have been separated without error.
Analysis of the Classification Report. For each object type, the key metrics — precision, recall and the F1 score — reached an absolute value of 1.00 ($100%$). The overall accuracy of the entire system is also 1.00, based on a test sample of 30 objects.
System performance. The time taken for the pipeline to complete and exit the code was less than 2 seconds (1.998 sec), which highlights the high computational efficiency of the chosen approach.
Conclusion. The machine learning pipeline implemented has demonstrated high effectiveness in object identification tasks. Thanks to a clear sequence of data pre-processing steps (in particular, mandatory scaling), it was possible to achieve maximum accuracy and completeness in classification.
References:
1. https://itwiki.dev/data-science/ml-reference/ml-glossary/machine-learning-pipeline
2. Python Machine Learning Cookbook, Chris Albon, Kyle Gallatin, O'Reilly Media, 2023
|