Main File
Main File
INTRODUCTION TO PROJECT
In today’s digital era, the use of Artificial Intelligence (AI) and Machine Learning (ML) has
significantly transformed various industries, including healthcare, fitness, and retail. These
technologies enable systems to analyze large volumes of data, identify patterns, and provide
intelligent predictions that support decision-making processes.
The objective of this internship project is to design and develop intelligent systems using
machine learning techniques to solve real-world problems. The project focuses on building
predictive models that can assist in healthcare diagnosis, fitness analysis, and business
decision-making.
The first part of the project involves the development of a Multiple Disease Prediction
System, which is capable of predicting diseases such as diabetes, heart disease, and
Parkinson’s disease based on user-provided medical parameters. This system helps in early
detection and awareness, enabling users to take preventive measures.
The second part of the project focuses on a Calorie Burn Prediction System. This system uses
regression-based machine learning techniques to estimate the number of calories burned
based on physical and exercise-related inputs such as age, weight, duration, heart rate, and
body temperature. This model can be useful for fitness tracking and personalized health
recommendations.
The third part of the project includes a Big Mart Sales Prediction System, which utilizes retail
data to analyze and predict product-related insights. This system helps in understanding
factors affecting product pricing and can support better inventory management and business
decisions.
All the models were developed using Python and implemented with machine learning
libraries such as Scikit-learn and XGBoost. The trained models were further integrated into a
web-based application using Streamlit, allowing users to interact with the system and obtain
real-time predictions.
Overall, this project demonstrates the practical application of machine learning in multiple
domains and highlights how data-driven approaches can be used to develop intelligent and
user-friendly systems.
1
Department of Artificial Intelligence and Machine Learning
CHAPTER 2
TOOLS & TECHNOLOGY USED
2.3.1 NumPy
NumPy was used for numerical computations and handling arrays. It provides efficient data
structures and mathematical functions required in machine learning applications.
2.3.2 Pandas
Pandas was used for data manipulation and analysis. It allows efficient handling of datasets in
the form of DataFrames and supports operations such as filtering, cleaning, and transforming
data.
2
Department of Artificial Intelligence and Machine Learning
2.3.3 Scikit-learn
Scikit-learn was used for implementing machine learning algorithms such as Logistic
Regression and Support Vector Machine. It was also used for splitting data into training and
testing sets and evaluating model performance.
2.3.4 XGBoost
XGBoost was used as an advanced machine learning algorithm for regression tasks. It is
known for its high performance and accuracy. It was used in the calorie burn prediction and
sales prediction models to improve prediction accuracy.
2.4.1 Streamlit
Streamlit was used to develop a web-based application for the disease prediction system. It
provides a simple and efficient way to build interactive web applications. Using Streamlit, a
user interface was created where users can input data and receive real-time predictions from
the trained machine learning models.
2.7 Summary
The combination of Python, machine learning libraries, and development tools enabled the
successful implementation of predictive systems. These technologies helped in building
efficient models, analyzing datasets, and deploying applications for real-world use.
3
Department of Artificial Intelligence and Machine Learning
CHAPTER 3
INTERNSHIP ACTIVITIES
During the internship at Neosprint India Private Limited, the primary focus was on
developing machine learning-based systems to solve real-world problems in healthcare,
fitness, and business analytics. The internship involved working on multiple projects that
required data analysis, model building, evaluation, and application development. The work
carried out during the internship can be divided into three major projects: Multiple Disease
Prediction System, Calorie Burn Prediction System, and Big Mart Sales Prediction System.
The Multiple Disease Prediction System was developed to predict the likelihood of various
diseases such as diabetes, heart disease, and Parkinson’s disease based on user input
parameters. The system was designed to assist in early detection and awareness.
Datasets for each disease were collected from Kaggle. The data included various medical
parameters such as age, blood pressure, glucose level, BMI, and other health indicators. The
datasets were analyzed using Pandas to understand their structure and features. Data
preprocessing techniques such as handling missing values and standardization were applied
to improve model performance.
Different machine learning algorithms were used for each disease prediction model. Support
Vector Machine (SVM) was used for diabetes and Parkinson’s disease prediction due to its
effectiveness in handling complex datasets. Logistic Regression was used for heart disease
prediction as it performs well in binary classification problems. The dataset was divided into
training and testing sets using an 80-20 split. The models were trained using the training data
and evaluated on the testing data.
The performance of the models was evaluated using accuracy scores. The diabetes model
achieved an accuracy of approximately 77%, the heart disease model achieved around 82%,
and the Parkinson’s model achieved around 87%. These results indicate that the models were
able to predict diseases with reasonable accuracy.
After training, the models were saved using the Pickle library in .sav format. These models
were then integrated into a web application using Streamlit. The application allows users to
input their health parameters and receive real-time predictions.
4
Department of Artificial Intelligence and Machine Learning
The Calorie Burn Prediction System was developed to estimate the number of calories burned
based on user physical and exercise-related attributes. This system helps in fitness tracking
and personalized health analysis.
Two datasets, exercise data and calorie data, were used and merged to create a single dataset.
The dataset contained features such as gender, age, height, weight, duration of exercise, heart
rate, and body temperature. Data preprocessing included checking for missing values,
converting categorical data into numerical format, and analyzing the dataset using statistical
methods.
An XGBoost Regressor model was used for predicting calories burned. The dataset was split
into training and testing sets. The model was trained using the training data and optimized to
improve performance.
The model performance was evaluated using Mean Absolute Error (MAE). The model
achieved a low MAE value, indicating that the predictions were close to actual values and the
model was highly accurate.
The Big Mart Sales Prediction System was developed to analyze retail data and predict
product-related insights. This system helps in understanding factors affecting product
performance and supports business decision-making.
The dataset used for this project contained 5681 records with multiple features related to
items and outlets. The data included both numerical and categorical variables. Missing values
in the dataset were handled using mean and mode techniques. Data cleaning was performed
to standardize categorical values. Label encoding was applied to convert categorical data into
numerical format.
An XGBoost Regressor model was used for prediction. The dataset was divided into training
and testing sets. The model was trained using various features such as item weight, item type,
outlet size, and item price.
The model performance was evaluated using the R-squared (R²) score. The model achieved a
high score on training data and a moderate score on testing data, indicating slight overfitting
but acceptable performance.
5
Department of Artificial Intelligence and Machine Learning
3.4 Integration and Implementation
The trained machine learning models were integrated into a web-based application using
Streamlit. The application provides a user-friendly interface where users can input data and
receive predictions in real time. The system demonstrates the integration of machine learning
models with a web interface, making it accessible to users without technical knowledge.
3.5 Summary
The internship activities involved working on multiple machine learning projects across
different domains. The experience included data preprocessing, model development,
evaluation, and deployment. These activities helped in understanding the practical
implementation of machine learning concepts and their application in real-world scenarios.
6
Department of Artificial Intelligence and Machine Learning
CHAPTER 4
RESULTS AND DISCUSSION
This chapter provides a detailed analysis of the results obtained from the machine learning
models developed during the internship. The performance of each system is evaluated using
appropriate metrics, and the outcomes are discussed in depth to understand their
effectiveness, reliability, and practical applications. The developed systems include the
Multiple Disease Prediction System, the Calorie Burn Prediction System, and the Big Mart
Sales Prediction System.
The primary objective of this chapter is to interpret the results rather than just present them.
Each model is analyzed based on its performance, behavior during training and testing, and
its ability to generalize to new data. In addition, factors such as data quality, preprocessing
techniques, and algorithm selection are also considered while discussing the results.
The Multiple Disease Prediction System was designed to predict the likelihood of diseases
such as diabetes, heart disease, and Parkinson’s disease based on user input. The system uses
machine learning classification algorithms trained on medical datasets.
The main goal of this system is to assist in early disease detection by analyzing health
parameters and identifying patterns that may indicate potential health risks. The system takes
various medical inputs from the user and provides a prediction indicating whether the person
is likely to have the disease or not.
The diabetes prediction model was developed using Support Vector Machine with a linear
kernel. The dataset used for this model included multiple medical features such as glucose
level, blood pressure, BMI, age, and insulin values. These features are important indicators
used in diagnosing diabetes.
The model was trained using an 80:20 train-test split. During the training phase, the model
learned the relationship between input features and the output variable. After training, the
model was tested on unseen data to evaluate its performance.
The model achieved an accuracy of approximately 77 percent on the test dataset. This
indicates that the model is capable of correctly predicting the presence or absence of diabetes
in most cases. However, the accuracy is not extremely high, which suggests that there is room
for improvement.
One of the reasons for this moderate performance is the presence of missing values and noise
in the dataset. Medical datasets often contain incomplete or inconsistent data, which can
affect the learning process of the model. Additionally, some features may not have a strong
relationship with the target variable, which can reduce prediction accuracy.
7
Department of Artificial Intelligence and Machine Learning
Despite these challenges, the model demonstrates that machine learning can be used
effectively for disease prediction. Further improvements can be made by applying advanced
preprocessing techniques, feature selection, and hyperparameter tuning.
The heart disease prediction model was developed using Logistic Regression. This algorithm
is widely used for binary classification problems and is known for its simplicity and
effectiveness.
The dataset used for this model contained structured features such as cholesterol levels, chest
pain type, resting blood pressure, and maximum heart rate achieved. These features are
commonly used in medical diagnosis and have a strong correlation with heart disease.
The model achieved an accuracy of approximately 82 percent, which is higher than the
diabetes prediction model. This improved performance can be attributed to the quality and
structure of the dataset. The features in this dataset are more relevant and have a stronger
relationship with the target variable.
Logistic Regression works well when the relationship between features and the output is
linear. In this case, the algorithm was able to learn the patterns effectively and produce
reliable predictions.
The results show that Logistic Regression is a suitable choice for heart disease prediction. It
provides consistent performance and can be easily interpreted, which is important in
healthcare applications.
The Parkinson’s disease prediction model was implemented using Support Vector Machine.
The dataset used for this model included multiple voice-related features, which are useful in
detecting Parkinson’s disease.
The model achieved an accuracy of approximately 87 percent, which is the highest among all
three disease prediction models. This indicates that the model performs very well in
identifying patterns in the dataset.
The high accuracy can be attributed to the quality of the dataset and the relevance of features.
The dataset contains well-defined features that are strongly related to the presence of the
disease, which helps the model learn effectively.
Support Vector Machine is particularly effective for datasets with high-dimensional features.
It works by finding the optimal boundary that separates different classes, which makes it
suitable for complex classification problems.
The results demonstrate that SVM is a powerful algorithm for disease prediction, especially
when the dataset contains meaningful and well-structured features.
8
Department of Artificial Intelligence and Machine Learning
A comparative analysis of the three disease prediction models shows that each model
performs differently based on the dataset and algorithm used.
The Parkinson’s disease model achieved the highest accuracy, followed by the heart disease
model and then the diabetes model. This variation in performance is mainly due to
differences in dataset quality, feature importance, and the complexity of the problem.
The analysis highlights the importance of selecting the right algorithm for each problem. It
also shows that the quality of data plays a crucial role in determining model performance.
Overall, the results confirm that machine learning can be effectively used for predicting
diseases and can assist in early diagnosis and preventive healthcare.
The Calorie Burn Prediction System was developed to estimate the number of calories burned
by an individual based on physical and exercise-related inputs. Unlike disease prediction, this
system is based on regression techniques where the output is a continuous numerical value
rather than a category.
The system takes multiple inputs such as age, gender, height, weight, duration of exercise,
heart rate, and body temperature. These parameters are important in determining the amount
of energy expenditure during physical activity.
The objective of this model is to provide an accurate estimation of calories burned so that
users can monitor their physical activity and maintain a healthy lifestyle.
The calorie prediction model was developed using the XGBoost Regressor algorithm.
XGBoost is an advanced machine learning algorithm based on gradient boosting, which is
known for its high accuracy and efficiency.
The dataset used for this model was created by combining two separate datasets: one
containing exercise-related data and the other containing calorie-related data. These datasets
were merged to form a comprehensive dataset with all required features.
Before training the model, several preprocessing steps were performed. These included
handling missing values, converting categorical variables such as gender into numerical form,
and analyzing the distribution of data. Proper preprocessing ensured that the model received
clean and structured data.
The dataset was then split into training and testing sets. The model was trained using the
training data, where it learned the relationship between input features and the target variable,
which is the number of calories burned.
The performance of the calorie prediction model was evaluated using Mean Absolute Error
(MAE). This metric measures the average difference between the actual and predicted values.
9
Department of Artificial Intelligence and Machine Learning
The model achieved a low MAE value of approximately 1.48, which indicates that the
predictions are very close to the actual values. A lower MAE value represents higher
accuracy and better performance of the model.
This result shows that the model is highly effective in predicting calorie burn and can be used
reliably in real-world applications.
The analysis of the results shows that the model is able to capture the relationship between
physical parameters and calorie burn effectively. Among all the features, duration of exercise
and heart rate were found to have the highest impact on the prediction.
Longer duration and higher heart rate generally result in higher calorie burn, which aligns
with real-world observations. The model successfully learns these patterns and provides
accurate predictions.
The model can be used in fitness tracking applications to help users monitor their activity
levels and plan their workouts accordingly. It can also be integrated into wearable devices
and health apps for real-time tracking.
Although the model performs well, there are certain limitations. The accuracy of the model
depends on the quality of input data. If incorrect or unrealistic values are provided, the
predictions may not be accurate.
Additionally, the model does not consider external factors such as metabolism, diet, or
environmental conditions, which can also affect calorie burn. Including such factors in future
models can improve accuracy.
The Big Mart Sales Prediction System was developed to analyze retail data and predict
product-related outcomes. This system is useful for business analytics, as it helps in
understanding factors that influence product performance.
The dataset used for this model included various features such as item type, item weight, item
price, outlet size, outlet location, and establishment year. These features are important in
determining product demand and sales patterns.
The model was developed using the XGBoost Regressor algorithm. This algorithm was
chosen because of its ability to handle large datasets and provide high accuracy.
10
Department of Artificial Intelligence and Machine Learning
Before training the model, extensive preprocessing was performed. Missing values were
handled using appropriate techniques such as mean and mode substitution. Categorical
variables were converted into numerical form using label encoding.
Data cleaning was also performed to standardize values and remove inconsistencies. These
steps ensured that the dataset was ready for training.
The dataset was then divided into training and testing sets. The model was trained on the
training data and evaluated on the testing data to measure its performance.
The performance of the model was evaluated using the R-squared (R²) score. This metric
indicates how well the model fits the data.
The model achieved an R² score of approximately 0.89 on the training dataset and around
0.60 on the testing dataset. The high training score indicates that the model has learned the
data well.
However, the lower testing score suggests that the model does not generalize perfectly to new
data. This difference in performance indicates the presence of overfitting.
The analysis shows that the model is able to identify patterns in retail data and provide useful
predictions. Features such as item price and outlet type were found to have a significant
impact on the output.
The model can be used to understand customer behavior, optimize pricing strategies, and
improve inventory management. It can also help businesses make data-driven decisions.
Despite the presence of overfitting, the model still provides valuable insights that can be used
in real-world scenarios.
One of the main limitations of this model is overfitting, which affects its ability to perform
well on new data. This issue can be addressed by using techniques such as cross-validation
and regularization.
Another limitation is the dependency on historical data. If the dataset does not represent
current market
The performance of machine learning models is influenced by several factors, including the
nature of the dataset, feature selection, algorithm choice, and preprocessing techniques.
During the internship, it was observed that each of these factors played a crucial role in
determining the final output of the models.
11
Department of Artificial Intelligence and Machine Learning
In classification models such as disease prediction, accuracy was used as the primary
evaluation metric. These models showed reasonably good performance, indicating their
ability to classify data correctly. However, accuracy alone is not always sufficient to evaluate
model performance, especially in cases where the dataset is imbalanced.
In regression models such as calorie burn prediction and sales prediction, evaluation metrics
such as Mean Absolute Error and R-squared score were used. These metrics provided a better
understanding of how close the predicted values were to the actual values.
It was also observed that advanced algorithms such as XGBoost provided better performance
compared to basic algorithms. This is because XGBoost uses boosting techniques to improve
model accuracy by combining multiple weak learners.
Data preprocessing is one of the most important steps in machine learning. The quality of
input data directly affects the performance of the model.
During the internship, various preprocessing techniques were applied to improve data quality.
These included handling missing values, encoding categorical variables, and standardizing
numerical features.
Handling missing values was necessary to ensure that the model receives complete data.
Techniques such as mean and mode substitution were used to fill missing values.
Categorical variables such as gender and item type were converted into numerical form using
encoding techniques. This allowed the model to process these features effectively.
Standardization was applied to numerical features to ensure that all features are on the same
scale. This is particularly important for algorithms such as Support Vector Machine.
Proper preprocessing helped in reducing noise in the data and improving the learning
capability of the models.
During the development of the models, it was observed that not all features contribute equally
to the output. Some features have a stronger influence, while others may have little or no
impact.
For example, in the calorie prediction model, features such as exercise duration and heart rate
had a significant impact on the output. In the sales prediction model, features such as item
price and outlet type were important.
By focusing on important features, the models were able to learn better patterns and produce
more accurate predictions.
12
Department of Artificial Intelligence and Machine Learning
Feature selection also helps in reducing model complexity and improving efficiency.
The internship involved working with both classification and regression models, which
provided an opportunity to compare their performance and characteristics.
Classification models are used for predicting categories, such as whether a disease is present
or not. These models provide discrete outputs and are evaluated using metrics such as
accuracy.
Regression models, on the other hand, are used for predicting continuous values, such as
calories burned or product sales. These models are evaluated using metrics such as Mean
Absolute Error and R-squared score.
The comparison between these models helped in understanding how different types of
problems require different approaches and evaluation techniques.
The machine learning models developed during the internship have several real-world
applications.
The disease prediction system can be used in healthcare applications to assist in early
diagnosis and awareness. It can help users understand potential health risks based on their
input parameters.
The calorie prediction system can be used in fitness applications to track physical activity and
provide personalized recommendations. It can also be integrated into wearable devices.
The sales prediction system can be used in business analytics to improve decision-making. It
can help organizations in inventory management, demand forecasting, and pricing strategies.
These applications demonstrate the practical usefulness of machine learning in solving real-
world problems.
They provide accurate predictions based on data, which helps in making informed decisions.
They automate complex processes and reduce manual effort.
The systems are user-friendly and can be easily accessed through web applications. This
improves usability and makes them accessible to a wider audience.
They can be integrated into real-world applications and can be scaled to handle larger
datasets.
13
Department of Artificial Intelligence and Machine Learning
Overall, the systems demonstrate the effectiveness of machine learning in modern
applications.
One of the major challenges was handling missing and inconsistent data. Poor data quality
can significantly affect model performance.
Another challenge was selecting the appropriate algorithm for each problem. Different
algorithms perform differently, and choosing the right one requires experimentation.
Overfitting was also observed in some models, particularly in the sales prediction model.
This required additional techniques such as regularization and validation.
Despite these challenges, the models were successfully developed and optimized to achieve
good performance.
There are several ways in which the models can be improved in the future.
Using larger and more diverse datasets can improve model accuracy and generalization.
Applying advanced machine learning techniques and deep learning algorithms can also
enhance performance.
Hyperparameter tuning can be used to optimize model parameters and achieve better results.
Cross-validation techniques can be applied to reduce overfitting.
In addition, incorporating more features and real-time data can further improve the
effectiveness of the models.
During the internship, an important part of the project was not only building machine
learning models but also integrating them into a usable system. The trained models were
deployed using a web-based interface developed with Streamlit.
This integration allowed users to interact with the models easily by providing input values
through a simple user interface. The system processes the input data and provides real-time
predictions based on the trained models.
The deployment process demonstrated how machine learning models can be converted into
practical applications. It also highlighted the importance of user interface design, as a well-
designed interface improves usability and accessibility.
The integration of models with a web application ensures that the system can be used by non-
technical users, making it more effective in real-world scenarios.
14
Department of Artificial Intelligence and Machine Learning
4.13 OVERALL DISCUSSION
The overall analysis of the results shows that machine learning techniques can be
successfully applied to solve problems in different domains such as healthcare, fitness, and
business.
Each model developed during the internship demonstrated the ability to learn patterns from
data and provide useful predictions. The classification models performed well in identifying
disease patterns, while regression models provided accurate numerical predictions.
The results also highlight the importance of data quality, preprocessing, and algorithm
selection in achieving good performance. Proper implementation of these factors leads to
better and more reliable models.
4.14 SUMMARY
This chapter presented a detailed evaluation and discussion of the machine learning models
developed during the internship. The performance of each model was analyzed using
appropriate evaluation metrics, and the results were interpreted to understand their
effectiveness.
The Multiple Disease Prediction System demonstrated the use of classification algorithms in
healthcare applications. The Calorie Burn Prediction System showed the effectiveness of
regression models in fitness analysis. The Big Mart Sales Prediction System highlighted the
role of machine learning in business analytics.
The chapter also discussed important aspects such as data preprocessing, feature selection,
model performance, limitations, and future improvements. Overall, the results confirm that
machine learning can be effectively used to develop intelligent systems for real-world
applications.
15
Department of Artificial Intelligence and Machine Learning
CHAPTER 5
CONCLUSION AND FUTURE SCOPE
This chapter summarizes the overall work carried out during the internship and highlights the
key learnings, outcomes, and future possibilities. The internship provided practical exposure
to machine learning concepts and their application in solving real-world problems across
different domains such as healthcare, fitness, and business analytics.
The main objective of the internship was to design, develop, and implement machine learning
models capable of making accurate predictions based on input data. This objective was
successfully achieved through the development of three major systems: Multiple Disease
Prediction System, Calorie Burn Prediction System, and Big Mart Sales Prediction System.
5.1 CONCLUSION
During the internship, significant knowledge and hands-on experience were gained in the
field of Artificial Intelligence and Machine Learning. The process began with understanding
datasets, followed by data preprocessing, model development, evaluation, and deployment.
The Calorie Burn Prediction System highlighted the use of regression techniques to estimate
calories burned based on physical and exercise-related parameters. The model achieved high
accuracy, indicating that machine learning can be effectively used in fitness applications to
provide personalized insights.
The Big Mart Sales Prediction System demonstrated the use of machine learning in business
analytics. The model helped in understanding product-related patterns and provided useful
insights that can support decision-making processes such as pricing and inventory
management.
Overall, the internship provided a complete understanding of the machine learning lifecycle,
including data collection, preprocessing, model building, evaluation, and deployment. It also
improved problem-solving skills and the ability to work with real-world datasets.
The internship helped in developing both technical and practical skills. A strong
understanding of Python programming was gained, along with experience in using libraries
such as NumPy, Pandas, Scikit-learn, and XGBoost.
16
Department of Artificial Intelligence and Machine Learning
Knowledge of data preprocessing techniques such as handling missing values, encoding
categorical data, and feature scaling was developed. These techniques are essential for
improving model performance.
Experience in building and evaluating machine learning models using different algorithms
was also gained. Understanding the differences between classification and regression models
was an important learning outcome.
The internship also improved analytical thinking, problem-solving ability, and the capability
to work on real-world projects.
Although the developed systems performed well, there are certain limitations that need to be
considered.
The performance of machine learning models depends heavily on the quality and size of the
dataset. Limited or noisy data can reduce accuracy and affect predictions.
Some models showed signs of overfitting, where the model performs well on training data
but not on testing data. This affects the generalization ability of the model.
The systems developed do not consider all possible real-world factors. For example, the
calorie prediction model does not include factors such as metabolism or diet, and the disease
prediction models do not replace professional medical diagnosis.
These limitations highlight the need for further improvements and more advanced
approaches.
There are several opportunities to improve and extend the developed systems in the future.
The use of larger and more diverse datasets can significantly improve model performance.
More data will help the model learn better patterns and make more accurate predictions.
Advanced machine learning techniques and deep learning algorithms can be applied to
improve accuracy and handle complex datasets. Techniques such as neural networks can be
explored for better performance.
Hyperparameter tuning and cross-validation can be used to optimize models and reduce
overfitting. This will improve the reliability of predictions.
The systems can be enhanced by integrating real-time data and external factors. For example,
the calorie prediction system can include additional parameters such as diet and
environmental conditions.
17
Department of Artificial Intelligence and Machine Learning
The user interface can also be improved to provide a better user experience. Mobile
application development can be considered to make the system more accessible.
In the healthcare domain, the disease prediction system can be extended to include more
diseases and integrate with medical databases. This can make the system more useful for
practical applications.
In the business domain, the sales prediction system can be improved by incorporating real-
time sales data and market trends.
Overall, the future scope of the project is vast, and continuous improvements can make the
system more accurate, reliable, and useful.
The knowledge and experience gained during the internship will be valuable for future
academic and professional growth. The project also highlights the importance of continuous
learning and improvement in the field of Artificial Intelligence and Machine Learning.
18
Department of Artificial Intelligence and Machine Learning
CHAPTER 6
LIMITATIONS, ETHICAL CONSIDERATIONS AND SECURITY
This chapter discusses the limitations of the developed systems along with ethical and
security considerations associated with machine learning applications.
The developed models depend heavily on the quality and size of the dataset. If the dataset is
incomplete, noisy, or biased, the model performance may be affected. In the disease
prediction system, medical datasets may not represent all population groups, which can
reduce accuracy for certain users.
The calorie prediction system does not consider external factors such as metabolism, diet, and
environmental conditions, which may affect accuracy.
Data privacy is another important aspect. User data should be handled securely and should
not be misused. Proper data protection techniques should be implemented.
Bias in data can also lead to unfair predictions. Therefore, it is important to use balanced and
diverse datasets.
Techniques such as input validation, secure APIs, and encryption can be used to improve
security. The system should also ensure that sensitive data is not exposed.
19
Department of Artificial Intelligence and Machine Learning
APPENDIX A
STREAMLIT WEB APPLICATION CODE
import os
import pickle
import streamlit as st
from streamlit_option_menu import option_menu
diabetes_model = [Link](open(f'{working_dir}/saved_models/diabetes_model.sav',
'rb'))
heart_disease_model =
[Link](open(f'{working_dir}/saved_models/heart_disease_model.sav', 'rb'))
parkinsons_model = [Link](open(f'{working_dir}/saved_models/parkinsons_model.sav',
'rb'))
['Diabetes Prediction',
'Heart Disease Prediction',
'Parkinsons Prediction'],
menu_icon='hospital-fill',
icons=['activity', 'heart', 'person'],
default_index=0)
# page title
[Link]('Diabetes Prediction using ML')
20
Department of Artificial Intelligence and Machine Learning
col1, col2, col3 = [Link](3)
with col1:
Pregnancies = st.text_input('Number of Pregnancies')
with col2:
Glucose = st.text_input('Glucose Level')
with col3:
BloodPressure = st.text_input('Blood Pressure value')
with col1:
SkinThickness = st.text_input('Skin Thickness value')
with col2:
Insulin = st.text_input('Insulin Level')
with col3:
BMI = st.text_input('BMI value')
with col1:
DiabetesPedigreeFunction = st.text_input('Diabetes Pedigree Function value')
with col2:
Age = st.text_input('Age of the Person')
diab_prediction = diabetes_model.predict([user_input])
if diab_prediction[0] == 1:
diab_diagnosis = 'The person is diabetic'
else:
diab_diagnosis = 'The person is not diabetic'
[Link](diab_diagnosis)
21
Department of Artificial Intelligence and Machine Learning
# Heart Disease Prediction Page
if selected == 'Heart Disease Prediction':
# page title
[Link]('Heart Disease Prediction using ML')
with col1:
age = st.text_input('Age')
with col2:
sex = st.text_input('Sex')
with col3:
cp = st.text_input('Chest Pain types')
with col1:
trestbps = st.text_input('Resting Blood Pressure')
with col2:
chol = st.text_input('Serum Cholestoral in mg/dl')
with col3:
fbs = st.text_input('Fasting Blood Sugar > 120 mg/dl')
with col1:
restecg = st.text_input('Resting Electrocardiographic results')
with col2:
thalach = st.text_input('Maximum Heart Rate achieved')
with col3:
exang = st.text_input('Exercise Induced Angina')
with col1:
oldpeak = st.text_input('ST depression induced by exercise')
with col2:
slope = st.text_input('Slope of the peak exercise ST segment')
with col3:
ca = st.text_input('Major vessels colored by flourosopy')
with col1:
thal = st.text_input('thal: 0 = normal; 1 = fixed defect; 2 = reversable defect')
22
Department of Artificial Intelligence and Machine Learning
# code for Prediction
heart_diagnosis = ''
user_input = [age, sex, cp, trestbps, chol, fbs, restecg, thalach, exang, oldpeak, slope,
ca, thal]
heart_prediction = heart_disease_model.predict([user_input])
if heart_prediction[0] == 1:
heart_diagnosis = 'The person is having heart disease'
else:
heart_diagnosis = 'The person does not have any heart disease'
[Link](heart_diagnosis)
# page title
[Link]("Parkinson's Disease Prediction using ML")
with col1:
fo = st.text_input('MDVP:Fo(Hz)')
with col2:
fhi = st.text_input('MDVP:Fhi(Hz)')
with col3:
flo = st.text_input('MDVP:Flo(Hz)')
with col4:
Jitter_percent = st.text_input('MDVP:Jitter(%)')
with col5:
Jitter_Abs = st.text_input('MDVP:Jitter(Abs)')
with col1:
RAP = st.text_input('MDVP:RAP')
23
Department of Artificial Intelligence and Machine Learning
with col2:
PPQ = st.text_input('MDVP:PPQ')
with col3:
DDP = st.text_input('Jitter:DDP')
with col4:
Shimmer = st.text_input('MDVP:Shimmer')
with col5:
Shimmer_dB = st.text_input('MDVP:Shimmer(dB)')
with col1:
APQ3 = st.text_input('Shimmer:APQ3')
with col2:
APQ5 = st.text_input('Shimmer:APQ5')
with col3:
APQ = st.text_input('MDVP:APQ')
with col4:
DDA = st.text_input('Shimmer:DDA')
with col5:
NHR = st.text_input('NHR')
with col1:
HNR = st.text_input('HNR')
with col2:
RPDE = st.text_input('RPDE')
with col3:
DFA = st.text_input('DFA')
with col4:
spread1 = st.text_input('spread1')
with col5:
spread2 = st.text_input('spread2')
with col1:
D2 = st.text_input('D2')
with col2:
24
Department of Artificial Intelligence and Machine Learning
PPE = st.text_input('PPE')
parkinsons_prediction = parkinsons_model.predict([user_input])
if parkinsons_prediction[0] == 1:
parkinsons_diagnosis = "The person has Parkinson's disease"
else:
parkinsons_diagnosis = "The person does not have Parkinson's disease"
[Link](parkinsons_diagnosis)
25
Department of Artificial Intelligence and Machine Learning
APPENDIX B
DIABETES MODEL TRAINING CODE
import numpy as np
import pandas as pd
from [Link] import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn import svm
from [Link] import accuracy_score
import pickle
print(diabetes_dataset['Outcome'].value_counts())
# 0 --> Non-Diabetic
# 1 --> Diabetic
print(diabetes_dataset.groupby('Outcome').mean())
print(X)
print(Y)
# Data Standardization
scaler = StandardScaler()
[Link](X)
standardized_data = [Link](X)
print(standardized_data)
X = standardized_data
Y = diabetes_dataset['Outcome']
26
Department of Artificial Intelligence and Machine Learning
print(X)
print(Y)
# Model Evaluation
# accuracy score on the training data
X_train_prediction = [Link](X_train)
training_data_accuracy = accuracy_score(X_train_prediction, Y_train)
print('Accuracy score of the training data : ', training_data_accuracy)
prediction = [Link](std_data)
print(prediction)
if prediction[0] == 0:
print('The person is not diabetic')
else:
print('The person is diabetic')
27
Department of Artificial Intelligence and Machine Learning
# Saving the trained model
filename = 'diabetes_model.sav'
[Link](classifier, open(filename, 'wb'))
prediction = loaded_model.predict(input_data_reshaped)
print(prediction)
if prediction[0] == 0:
print('The person is not diabetic')
else:
print('The person is diabetic')
28
Department of Artificial Intelligence and Machine Learning
APPENDIX C
HEART DISEASE MODEL TRAINING CODE
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from [Link] import accuracy_score
import pickle
# dataset shape
print(heart_data.shape)
# statistical measures
print(heart_data.describe())
print(X)
print(Y)
29
Department of Artificial Intelligence and Machine Learning
print('Training Accuracy:', training_data_accuracy)
# predictive system
input_data = (52,1,0,125,212,0,1,168,0,1.0,2,2,3)
input_data_as_numpy_array = [Link](input_data)
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
prediction = [Link](input_data_reshaped)
if prediction[0] == 0:
print('The person does not have heart disease')
else:
print('The person has heart disease')
prediction = loaded_model.predict(input_data_reshaped)
if prediction[0] == 0:
print('The person does not have heart disease')
else:
print('The person has heart disease')
30
Department of Artificial Intelligence and Machine Learning
APPENDIX D
PARKINSON’S DISEASE PREDICTION MODEL TRAINING CODE
import numpy as np
import pandas as pd
from [Link] import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn import svm
from [Link] import accuracy_score
import pickle
# first 5 rows
print(parkinsons_data.head())
# dataset shape
print(parkinsons_data.shape)
# statistical measures
print(parkinsons_data.describe())
print(X)
print(Y)
# data standardization
scaler = StandardScaler()
[Link](X)
X = [Link](X)
print(X)
31
Department of Artificial Intelligence and Machine Learning
# training the model
model = [Link](kernel='linear')
[Link](X_train, Y_train)
# predictive system
input_data = (
119.992,157.302,74.997,0.00784,0.00007,0.00370,0.00554,0.01109,
0.04374,0.426,0.02182,0.03130,0.02971,0.06545,0.02211,21.033,
0.414783,0.815285,-4.813031,0.266482,2.301442,0.284654
)
input_data_as_numpy_array = [Link](input_data)
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
prediction = [Link](input_data_reshaped)
if prediction[0] == 0:
print("The person does not have Parkinson's disease")
else:
print("The person has Parkinson's disease")
prediction = loaded_model.predict(input_data_reshaped)
if prediction[0] == 0:
print("The person does not have Parkinson's disease")
else:
print("The person has Parkinson's disease")
32
Department of Artificial Intelligence and Machine Learning
APPENDIX E
CALORIE BURN PREDICTION MODEL TRAINING CODE
import numpy as np
import pandas as pd
import [Link] as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor
from sklearn import metrics
exercise_data = pd.read_csv('/content/[Link]')
print(exercise_data.head())
# statistical analysis
print(calories_data.describe())
# data visualization
[Link]()
# distribution of Age
[Link](calories_data['Age'])
[Link]()
# distribution of Height
[Link](calories_data['Height'])
33
Department of Artificial Intelligence and Machine Learning
[Link]()
# distribution of Weight
[Link](calories_data['Weight'])
[Link]()
# heatmap
[Link](figsize=(10, 10))
[Link](correlation, cbar=True, square=True, fmt='.1f', annot=True,
annot_kws={'size': 8}, cmap='Blues')
[Link]()
print(X)
print(Y)
# model training
model = XGBRegressor()
[Link](X_train, Y_train)
# sample prediction
sample_input = [Link](
[[0, 25, 170.0, 70.0, 20.0, 95.0, 40.0]],
34
Department of Artificial Intelligence and Machine Learning
columns=['Gender', 'Age', 'Height', 'Weight', 'Duration', 'Heart_Rate', 'Body_Temp']
)
sample_prediction = [Link](sample_input)
print("Predicted Calories Burnt:", sample_prediction[0])
35
Department of Artificial Intelligence and Machine Learning
APPENDIX F
BIG MART SALES PREDICTION MODEL TRAINING CODE
import numpy as np
import pandas as pd
import [Link] as plt
import seaborn as sns
from [Link] import LabelEncoder
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor
from sklearn import metrics
miss_values = big_mart_data['Outlet_Size'].isnull()
36
Department of Artificial Intelligence and Machine Learning
print(big_mart_data.isnull().sum())
# statistical analysis
print(big_mart_data.describe())
# data visualization
[Link]()
37
Department of Artificial Intelligence and Machine Learning
big_mart_data.replace(
{'Item_Fat_Content': {'low fat': 'Low Fat', 'LF': 'Low Fat', 'reg': 'Regular'}},
inplace=True
)
print(big_mart_data['Item_Fat_Content'].value_counts())
# label encoding
encoder = LabelEncoder()
big_mart_data['Item_Identifier'] = encoder.fit_transform(big_mart_data['Item_Identifier'])
big_mart_data['Item_Fat_Content'] =
encoder.fit_transform(big_mart_data['Item_Fat_Content'])
big_mart_data['Item_Type'] = encoder.fit_transform(big_mart_data['Item_Type'])
big_mart_data['Outlet_Identifier'] =
encoder.fit_transform(big_mart_data['Outlet_Identifier'])
big_mart_data['Outlet_Size'] = encoder.fit_transform(big_mart_data['Outlet_Size'])
big_mart_data['Outlet_Location_Type'] =
encoder.fit_transform(big_mart_data['Outlet_Location_Type'])
big_mart_data['Outlet_Type'] = encoder.fit_transform(big_mart_data['Outlet_Type'])
print(big_mart_data.head())
print(X)
print(Y)
# model training
regressor = XGBRegressor()
[Link](X_train, Y_train)
# R squared value
r2_train = metrics.r2_score(Y_train, training_data_prediction)
print("R Squared value (Training): ", r2_train)
38
Department of Artificial Intelligence and Machine Learning
# prediction on test data
test_data_prediction = [Link](X_test)
# R squared value
r2_test = metrics.r2_score(Y_test, test_data_prediction)
print("R Squared value (Test): ", r2_test)
# sample prediction
sample_input = X_test.iloc[0:1]
sample_output = [Link](sample_input)
print("Sample Predicted Sales:", sample_output[0])
39
Department of Artificial Intelligence and Machine Learning
REFERENCES
Artificial Intelligence and Machine Learning concepts from standard online resources
Scikit-learn documentation – [Link]
XGBoost documentation – [Link]
Kaggle datasets – [Link]
Python documentation – [Link]
Streamlit documentation – [Link]
40
Department of Artificial Intelligence and Machine Learning
LIST OF ABBREVIATIONS
AI – Artificial Intelligence
ML – Machine Learning
SVM – Support Vector Machine
MAE – Mean Absolute Error
R² – R-Squared
API – Application Programming Interface
UI – User Interface
CSV – Comma Separated Values
EDA – Exploratory Data Analysis
XGBoost – Extreme Gradient Boosting
41
Department of Artificial Intelligence and Machine Learning
GLOSSARY
Machine Learning – A method of data analysis that automates analytical model building
Artificial Intelligence – Simulation of human intelligence in machines
Classification – A machine learning task where output is a category
Regression – A machine learning task where output is a continuous value
Dataset – A collection of related data
Model – A trained system used for prediction
Training Data – Data used to train the model
Testing Data – Data used to evaluate the model
Overfitting – When a model performs well on training data but poorly on new data
Feature – Input variable used for prediction
42
Department of Artificial Intelligence and Machine Learning
PROJECT OBJECTIVES
The main objective of this project is to develop machine learning models that can solve real-
world problems efficiently. The project focuses on building systems for disease prediction,
calorie estimation, and sales forecasting.
The project aims to develop accurate models, analyze real-world datasets, implement data
preprocessing techniques, deploy models using web applications, and provide user-friendly
prediction systems.
43
Department of Artificial Intelligence and Machine Learning
SYSTEM REQUIREMENTS
Hardware Requirements:
Laptop/Desktop
Minimum 4GB RAM
Internet Connection
Software Requirements:
Python
Anaconda Navigator
Google Colab
Streamlit
Spyder / VS Code
44
Department of Artificial Intelligence and Machine Learning