Code Monkey home page Code Monkey logo

predicting-heart-disease-using-machine-learning's Introduction

Predicting-Heart-Disease-using-Machine-Learning

  1. 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.
  2. 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.
  3. 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).
  4. 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.
  5. K-Nearest Neighbors (KNN) Tuning:

    • The code explores the performance of K-Nearest Neighbors with different numbers of neighbors, and the results are plotted.
  6. 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.
  7. Grid Search:

    • Further hyperparameter tuning is conducted using grid search for Logistic Regression.
    • The best parameters and the corresponding model scores are displayed.
  8. Model Evaluation Metrics:

    • Confusion matrix, classification report, and ROC curve are utilized to evaluate the performance of the tuned Logistic Regression model.
  9. Cross-Validation:

    • Cross-validation scores for accuracy, precision, recall, and F1 score are calculated and visualized using bar plots.
  10. 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.
  11. 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 People

Contributors

rpruthvikashyap avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.