Book Image

Practical Machine Learning Cookbook

By : Atul Tripathi
Book Image

Practical Machine Learning Cookbook

By: Atul Tripathi

Overview of this book

Machine learning has become the new black. The challenge in today’s world is the explosion of data from existing legacy data and incoming new structured and unstructured data. The complexity of discovering, understanding, performing analysis, and predicting outcomes on the data using machine learning algorithms is a challenge. This cookbook will help solve everyday challenges you face as a data scientist. The application of various data science techniques and on multiple data sets based on real-world challenges you face will help you appreciate a variety of techniques used in various situations. The first half of the book provides recipes on fairly complex machine-learning systems, where you’ll learn to explore new areas of applications of machine learning and improve its efficiency. That includes recipes on classifications, neural networks, unsupervised and supervised learning, deep learning, reinforcement learning, and more. The second half of the book focuses on three different machine learning case studies, all based on real-world data, and offers solutions and solves specific machine-learning issues in each one.
Table of Contents (21 chapters)
Practical Machine Learning Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
14
Case Study - Forecast of Electricity Consumption

Decision tree learning - Advance Health Directive for patients with chest pain


An Advance Health Directive document states the directions regarding the future health care for an individual on various medical conditions. It guides an individual to make the right decision in case of emergency or as required. The document helps an individual to understand the nature and consequences of their health care decisions, understand the nature and effect of the directive, freely and voluntarily make these decisions, and communicate the decisions in some way.

Getting ready

In order to perform decision tree classification, we will be using a dataset collected from the heart patients dataset.

Step 1 - collecting and describing the data

The dataset titled Heart.csv which is available in CSV format, will be used. The dataset is in standard format. There are 303 rows of data. There are 15 variables. The numeric variables are as follows:

  • Age
  • Sex
  • RestBP
  • Chol
  • Fbs
  • RestECG
  • MaxHR
  • ExAng
  • Oldpeak
  • Slope
  • Ca

The non-numeric variables...