Title: Data Cleaning and Model Evaluation for Machine Learning Projects
Submitted by
Shreya Reddy
Lewis University
Course: Supervised Machine Learning
Instructor: Mahmood Al-Khassaweneh
Date: 10/17/2024
Abstract- In this report I present the how missing and inaccurate data were
outcome of programming projects in my managed, what machine learning models
master course for weeks 6 and 7. It was were used and how their performance was
designed to encompass tasks like cleaning assessed using standard metrics including
and reshaping raw data in a dataset, accuracy, precision, recall and F1-score.
applying several types of models drawn
from the field of machine learning to that II. DATA CLEANING PROCESS
dataset, and then assessing the A: Missing data: Its causes and
performance of the various models. management
Removing the noise was important in It should be noted that for this project, the
enhancing the quality of the models, and dataset has several rows with at least one
the following classification techniques missing or improperly filled value that
were used. This paper presents an could affect the operation of machine
overview of the data cleansing procedure, learning algorithms. Missing data was
the models applied in the analysis and the handled by employing multiple techniques,
assessment used. The outcome shows us including:
why it is crucial to clean the data and ● Imputation: Whenever the
select the correct model to enhance the excluded data was numerical, I
predictive power. applied mean and median
imputation to complete the missing
Keywords - data preprocessing, algorithm, data. In the case of categorical
classification models, metrics, accuracy data, the option of mode
imputation was considered.
I INTRODUCTION ● Removal of Incomplete Rows: As
The objective of the programming projects for some cases where many
in weeks 6 and 7 was to preprocess a given observations were missing, I
dataset, fit selected machine learning eliminated such rows to avoid
models on it, and compare the efficiency distorting the model analysis at
of the models to handle a classification hand.
task. In these weeks, I assumed a
consultant position and the goal was to B. Handling Outliers
explain why data preprocessing is crucial The dataset consisted of numeric fields
and how to select proper models to address and there were outlying values which
an actual problem. This report explains affected the results. The outliers for these
variables were corrected by using the model is, generally, utilised due to its
interquartile range (IQR) approach. They simplicity and ease of interpretation. In
are data points which fall below 1.5IQR or logistic regression, the possibility of a
above 75 IQR; they affect the training of given point x set in a certain class is
the models by leading it astray by estimated by mapping the data set to the
presenting patterns that do not apply. logistic function. However as we have
C. Feature Scaling and Normalisation seen the logistic regression model fared
As a result of this, feature scaling was used well as a baseline model for the dataset
to bring the values of the independent provided.
variables on the same platform that would
enable the machine learning models to
learn effectively from the data. This was
achieved by employing MinMaxScaler in
which all features are scaled to a range of B. Decision Trees
0 and 1. This is much needed in algorithms A Decision Tree classifier was also used.
such as SVM and KNN as these The idea of a decision tree is as follows,
algorithms work depending on the features the data set is divided into subsets on the
magnitude. basis of the features in the data set and it
D. Categorical Data Encoding forms a tree-like structure. Each node of
The assigned dataset included categorial the model is a decision rule with branches
features that were required to be encoded showing outcomes of the rule. Even
in order to feed them into the machine though this chosen model of building the
learning algorithms. One hot encoder was decision tree is reasonably easy to work
employed in order to encode the with in terms of interpretability and seems
categorical variables as binary vectors. to work well on a large number of case
This has been preferred over label studies it is sensitive to overfitting and
encoding because it does not bring any therefore needs to be regularly adjusted.
relationship between categories’ order in C. Random Forest
theStrings strings list. The problem of overfitting which I found
in the decision tree model is prevented by
III. MACHINE LEARNING MODELS using the Random Forest classifier which
A. Logistic Regression is an ensemble method built using decision
The first classification model used for the trees (Gong, et al, 2023). In classification
cleaned data was logistic regression. This
and regression, Random forests produce very accurate especially when we use the
several decision trees in the learning model on imbalanced datasets.
process and combine their classification or B. Precision ,Recall and F1 Score
regression. This model proved to be very Accuracy is defined as the ratio of totals
fast, especially when the appropriate that are correctly identified out of all totals
number of trees and the depth of each tree identified as such by a model (Lee, et al,
was decided. 2021). Sensitivity (or recall) quantifies the
D. Support Vector Machine number of actual positives assigned to the
I deployed a Support Vector Machine group of true positives among all existing
(SVM) , a kind of classification algorithm actual positives in the dataset.
that tries to find the hyperplane that creates F1-score is a combination of precision and
the biggest margin between the classes in recall ratio and it is recommended in cases
the feature space. SVM is more suitable of imbalanced data sets.
for use in high dimensions but this comes C. Confusion Matrix
with attendant problems, this includes the The confusion matrix helped to pry into
need to carefully select the values of the the performances of the models as it
regularisation term and the type of kernel showed the true positive counts, true
to be used. negative counts, false positive and false
negative counts. This matrix was
specifically useful in identifying where the
model was going wrong especially in
terms of the false positive and false
negative results.
IV. MODEL EVALUATION
To assess the effectiveness of each model,
I used several evaluation metrics:
A. Accuracy
Accuracy is the easiest metric which
predicts that out of all the instances on
each fold/round X%, were right. Accuracy
is a measure that gives overall
performance of the model, but it is not V. TABLE
solved the classification problem; the
Model Accu Preci recall F1
experience I got from this project is
racy sion Score
valuable in future machine learning
Logistic 85% 0.83 0.79 0.81 projects in dealing with real-world data
regressi chaos.
on
Decisio 80% 0.76 0.81 0.78
n Tree
Random 89% 0.85 0.84 0.84
forest
SVM 86% 0.83 0.82 0.82
TABLE 1
In the table the Random Forest classifier
outperformed other models in terms of
accuracy, precision, recall and F1 score.
The support vector machine also
performed well and slightly outperformed
logistic regression but falling short of
random forest’s performance.
VI. CONCLUSION
adding unto this week’s programming
projects from weeks 6 and 7 recapitulated
a crucial step of the machine learning
process: data cleaning and preparation.
Despite not being able handle missing
data, addressing outliers, and scaling
features, further enhanced the outcomes of
the model. In their application, Random
Forest was identified as the most effective,
with Support Vector Machines close
behind. These models fitting appropriately
VII. REFERENCES Computer Trends and Technology, 71(9),
Dataset 16-27.
Link:-[Link] [6]. Gong, Y., Liu, G., Xue, Y., Li, R., &
02/dry+bean+dataset
Meng, L. (2023). A survey on dataset
[1]. Lee, G. Y., Alzamil, L., Doskenov, B.,
quality in machine learning. Information
& Termehchy, A. (2021). A survey on data
and Software Technology, 162, 107268.
cleaning methods for improved machine
learning model performance. arXiv
preprint arXiv:2109.07127.
[2]. Lwakatare, L. E., Rånge, E., Crnkovic,
I., & Bosch, J. (2021, May). On the
experiences of adopting automated data
validation in an industrial machine
learning project. In 2021 IEEE/ACM 43rd
International Conference on Software
Engineering: Software Engineering in
Practice (ICSE-SEIP) (pp. 248-257).
IEEE.
[3]. Guha, S., Khan, F. A., Stoyanovich, J.,
& Schelter, S. (2024). Automated data
cleaning can hurt fairness in machine
learning-based decision making. IEEE
Transactions on Knowledge and Data
Engineering.
[4]. Habib, M., & Okayli, M. (2024).
Evaluating the sensitivity of machine
learning models to data preprocessing
technique in concrete compressive strength
estimation. Arabian Journal for Science
and Engineering, 1-19.
[5]. Rangineni, S. (2023). An analysis of
data quality requirements for machine
learning development pipelines
frameworks. International Journal of