Giter Site home page Giter Site logo

psavarmattas / stroke-prediction-ml-model Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7.34 MB

This is just a theoretical Machine Learning Model that will analyze the data and determine where the stroke can occur.

License: MIT License

Jupyter Notebook 100.00%
machine-learning python classification decision-tree-classifier knearest-neighbor-classifier logistic-regression multi-layer-perceptron random-forest scikit-learn sklearn

stroke-prediction-ml-model's Introduction

Brain Stroke Prediction - Stacking Model

Last Updated: 10th December 2022

THIS RESEARCH IS PUBLISHED PLEASE CLICK HERE FOR READING THE PAPER

A stroke is an interruption of the blood supply to any part of the brain. If blood flow was stopped for longer than a few seconds and the brain cannot get blood and oxygen, brain cells can die, and the abilities controlled by that area of the brain are lost. In this Notebook we will use some features to see wether we will be able to predict the stoke or not? This is just a theoretical Machine Learning Model that will analyze the data and determine where the stroke can occur.

Basic Outline For A Machine Learning Model:

Points to keep in mind when working with a machine learning model

  1. Import the Data
  2. Clean the Data
  3. Split the Data into Training/Test Sets
  4. Create Model
  5. Train the Model
  6. Make Predictions
  7. Evaluate and Improve

Libraries Needed:

  1. Numpy
  2. Pandas
  3. Matplotlib
  4. Scikit-Learn
  5. Seaborn
  6. Cufflinks

Tools Needed:

  1. Jupyter (IDE)
  2. Github (To pull repository)

Installation Instructions:

  1. Clone the repository.
  2. Open terminal and 'cd' to the directory where to saved the repository.
  3. Run the command pip install -r requirements.txt.
  4. Now start working on the repository.

Methodology:

  1. IMPORTING LIBRARIES AND LOADING DATA

  2. DATA EXPLORATION

  3. DATA PREPROCESSING

    a. Target and Feature values / Train Test Split

  4. MODEL BUILDING

    a. KNeighborsClassifier

    b. Support Vector Classification (SVC)

    c. Decision Tree Classifier

    d. Random Forest Classifier

    e. Multi-layer Perceptron classifier

    f. Stacking Classifier

  5. Prediction Testing

In-Depth Working of this model:

Imports

  1. Numpy: For working with arrays.
  2. Pandas: Used to analyze the data.
  3. OS Module: For working with files/directories.
  4. matplotlib: Used for programmatic plot generation.
  5. Seaborn: Used for statistical graphics.
  6. Warnings: Used to control warnings in Python.
  7. sklearn: These are simple and efficient tools for predictive data analsis.

Data Exploration

  1. pd.read_csv: Used to load cvs files in pandas dataframe.
  2. df.head: It returns first 'n' rows.
  3. pd.info: It prints information about the dataframe.
  4. df.describe: It generates descriptive statistics.
  5. unique: It returns unique values from the dataframe.

Data Preprocessing

  1. df.isnull: It detects missing values.
  2. df.drop: It drops speficied labels from rows and columns.
  3. get_dummies: It converts categorial variable into dummy/indicator variable.
  4. df.dropna: It drops coloumns and rows where null value is present.

Model Building

  1. KNeighborsClassifier: Classifier implementing the k-nearest neighbors vote.
  2. Support Vector Classification (SVC): SVC is class capable of performing binary and multi-class classification on a dataset.
  3. Decision Tree Classifier: Decision Trees (DTs) are a non-parametric supervised learning method used for classification and regression. The goal is to create a model that predicts the value of a target variable by learning simple decision rules inferred from the data features. A tree can be seen as a piecewise constant approximation.
  4. Random Forest Classifier: A random forest is a meta estimator that fits a number of decision tree classifiers on various sub-samples of the dataset and uses averaging to improve the predictive accuracy and control over-fitting. The sub-sample size is controlled with the max_samples parameter if bootstrap=True (default), otherwise the whole dataset is used to build each tree.
  5. Multi-layer Perceptron classifier: This model optimizes the log-loss function using LBFGS or stochastic gradient descent.
  6. Stacking Classifier: Stacked generalization consists in stacking the output of individual estimator and use a classifier to compute the final prediction. Stacking allows to use the strength of each individual estimator by using their output as input of a final estimator. 7.. joblib.dump: It collects all the learning and dumps it in one file.
  7. joblib.load: It reconstructs the file for use which is created by 'dump' method.

Prediction Testing

  1. random: It generates random output.

stroke-prediction-ml-model's People

Contributors

psavarmattas avatar

Stargazers

 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.