Book Image

Machine Learning for Healthcare Analytics Projects

Book Image

Machine Learning for Healthcare Analytics Projects

Overview of this book

Machine Learning (ML) has changed the way organizations and individuals use data to improve the efficiency of a system. ML algorithms allow strategists to deal with a variety of structured, unstructured, and semi-structured data. Machine Learning for Healthcare Analytics Projects is packed with new approaches and methodologies for creating powerful solutions for healthcare analytics. This book will teach you how to implement key machine learning algorithms and walk you through their use cases by employing a range of libraries from the Python ecosystem. You will build five end-to-end projects to evaluate the efficiency of Artificial Intelligence (AI) applications for carrying out simple-to-complex healthcare analytics tasks. With each project, you will gain new insights, which will then help you handle healthcare data efficiently. As you make your way through the book, you will use ML to detect cancer in a set of patients using support vector machines (SVMs) and k-Nearest neighbors (KNN) models. In the final chapters, you will create a deep neural network in Keras to predict the onset of diabetes in a huge dataset of patients. You will also learn how to predict heart diseases using neural networks. By the end of this book, you will have learned how to address long-standing challenges, provide specialized solutions for how to deal with them, and carry out a range of cognitive tasks in the healthcare domain.
Table of Contents (7 chapters)

Building the network

We are now done with the data preprocessing that is necessary to prepare the data for machine learning. Now, it's time to start the fun part, where we actually get to build a neural network. We will train it using our training data, and then test it on our testing dataset:

  1. Let's go ahead and import the layers and models that we need to build the model. The following lines of code show all the imported layers:
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam

In the preceding code snippet, Adam is the standard optimizer that people use with deep neural networks and Keras.

  1. The next step is defining a function to build the Keras model, which can be done via the create_model() function. This function also gives us a way to replicate the model with slightly different parameters by defining inputs.
  2. Now...