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.
Points to keep in mind when working with a machine learning model
- Import the Data
- Clean the Data
- Split the Data into Training/Test Sets
- Create Model
- Train the Model
- Make Predictions
- Evaluate and Improve
- Numpy
- Pandas
- Matplotlib
- Scikit-Learn
- Seaborn
- Cufflinks
- Jupyter (IDE)
- Github (To pull repository)
- Clone the repository.
- Open terminal and 'cd' to the directory where to saved the repository.
- Run the command
pip install -r requirements.txt
. - Now start working on the repository.
-
IMPORTING LIBRARIES AND LOADING DATA
-
DATA EXPLORATION
-
DATA PREPROCESSING
a. Target and Feature values / Train Test Split
-
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
-
Prediction Testing
- Numpy: For working with arrays.
- Pandas: Used to analyze the data.
- OS Module: For working with files/directories.
- matplotlib: Used for programmatic plot generation.
- Seaborn: Used for statistical graphics.
- Warnings: Used to control warnings in Python.
- sklearn: These are simple and efficient tools for predictive data analsis.
- pd.read_csv: Used to load cvs files in pandas dataframe.
- df.head: It returns first 'n' rows.
- pd.info: It prints information about the dataframe.
- df.describe: It generates descriptive statistics.
- unique: It returns unique values from the dataframe.
- df.isnull: It detects missing values.
- df.drop: It drops speficied labels from rows and columns.
- get_dummies: It converts categorial variable into dummy/indicator variable.
- df.dropna: It drops coloumns and rows where null value is present.
- KNeighborsClassifier: Classifier implementing the k-nearest neighbors vote.
- Support Vector Classification (SVC): SVC is class capable of performing binary and multi-class classification on a dataset.
- 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.
- 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.
- Multi-layer Perceptron classifier: This model optimizes the log-loss function using LBFGS or stochastic gradient descent.
- 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.
- joblib.load: It reconstructs the file for use which is created by 'dump' method.
- random: It generates random output.