Skip to content

MACHINE LEARNING : Classified the hospital re-admission probability of a DIABETIC patient by using appropriate Data Science techniques such as Feature Engineering and Model Deployment

Notifications You must be signed in to change notification settings

Manishms18/Identify-Diabetic-Patient-Readmission

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Identify-Diabetic-Patient-Readmission

Classifying the hospital re-admission probability of a DIABETIC patient by using appropriate Data Science techniques. You can view the project demo on YouTube.

Table of contents

General info

Project was binary classification (Supervised Learning) problem. Major steps involved were as follow :

  • STEP: 1 - Data Cleaning
  • STEP: 2 - Feature Engineering and Feature Creation
  • STEP: 3 - Transformation and Outlier Removal
  • STEP: 4 - Exploratory Data Analysis and Sampling
  • STEP: 5 - Model Building and Evaluation
  • STEP: 6 - Best Model and Deployment
  • STEP: 7 - Interpretations and Insights
  • STEP: 8 - Improvements and Future Work

Demo

Example screenshot

The entire demo of the project can be found on YouTube.

Screenshots

Example screenshot Example screenshot Example screenshot Example screenshot

Technologies and Tools

  • Python
  • Flask
  • Scikit-learn
  • HTML

Code Examples

# Code for creating pickle file of model and transform  

import pickle

pickle.dump(scaler, open('tranform.pkl','wb'))
pickle.dump(rf_clf, open('model.pkl','wb'))

X_test=scaler.transform(X_test_unscaled[:1])

predictions=rf_clf.predict(X_test)
print("Predicted Result : ",predictions)

predictions = rf_clf.predict_proba(X_test)
print("Predicted Result probability : ",predictions)

# Flask code for using deployed pickle file and connecting to interface

import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle

app = Flask(__name__)
scaler = pickle.load(open('tranform.pkl','rb'))
model = pickle.load(open('model.pkl', 'rb'))

@app.route('/')
def home():
    return render_template('interface.html')

@app.route('/predict',methods=['POST'])
def predict():
    '''
    For rendering results on HTML GUI
    '''
    int_features = [int(x) for x in request.form.values()]
    
    final_features = [np.array(int_features)]
    
    final_features = np.pad(final_features, (0, 63), 'constant')
    
    final_features = scaler.transform(final_features)
    
    prediction = model.predict_proba(final_features)

    output = prediction[0]

    return render_template('interface.html', prediction_text='Readmission probability is {}'.format(output))

if __name__ == "__main__":
    app.run(debug=True)

Status

Project is: finished.

Contact

If you loved what you read here and feel like we can collaborate to produce some exciting stuff, or if you just want to shoot a question, please feel free to connect with me on email or LinkedIn

About

MACHINE LEARNING : Classified the hospital re-admission probability of a DIABETIC patient by using appropriate Data Science techniques such as Feature Engineering and Model Deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published