-
Data Loading and Exploration:
- The dataset is loaded from Kaggle, containing various features related to heart disease.
- Exploratory data analysis (EDA) is performed to understand the data structure and characteristics.
-
Data Preprocessing:
- Features (
X
) and target (y
) variables are defined based on the dataset columns. - The dataset is split into training and testing sets using the
train_test_split
function.
- Features (
-
Model Selection:
- Three different classification models are chosen: Logistic Regression, K-Nearest Neighbors (KNN), and Random Forest.
- The models are initialized and stored in a dictionary (
models
).
-
Model Training and Evaluation:
- A function (
fit_and_score
) is defined to train and evaluate each model on the training and testing sets. - The accuracy scores of the models are then compared, and a bar plot is generated for visual representation.
- A function (
-
K-Nearest Neighbors (KNN) Tuning:
- The code explores the performance of K-Nearest Neighbors with different numbers of neighbors, and the results are plotted.
-
Hyperparameter Tuning:
- Randomized search is performed for hyperparameter tuning of Logistic Regression and Random Forest using
RandomizedSearchCV
. - The best parameters and the corresponding model scores are displayed.
- Randomized search is performed for hyperparameter tuning of Logistic Regression and Random Forest using
-
Grid Search:
- Further hyperparameter tuning is conducted using grid search for Logistic Regression.
- The best parameters and the corresponding model scores are displayed.
-
Model Evaluation Metrics:
- Confusion matrix, classification report, and ROC curve are utilized to evaluate the performance of the tuned Logistic Regression model.
-
Cross-Validation:
- Cross-validation scores for accuracy, precision, recall, and F1 score are calculated and visualized using bar plots.
-
Feature Importance:
- The coefficients of the Logistic Regression model are examined to determine feature importance.
- Bar plots are generated to visualize the importance of each feature.
-
Conclusion:
- The code concludes by displaying cross-validated metrics and feature importance, providing insights into the trained model's performance and the importance of different features in predicting heart disease.
predicting-heart-disease-using-machine-learning's Introduction
predicting-heart-disease-using-machine-learning's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.