Skip to main content

Evaluating our Heart Disease Classifier

Let's continue our descent by evaluating how good our heart disease classifier is.

We can do this by generating predictions on the test set and see how the predictions compare to the test set's ground truth labels. That can be done with the following lines of code:
At the bottom we can see that the classifier predicted 24 true negatives, 9 false positives, 8 false negatives, and 19 true positives. That's pretty okay. There is obviously some inaccuracy in the predictions, but let's calculate the accuracy anyways. (24+19)/(24+19+8+9)=71.6.

So the test accuracy was 71.6, while, if you recall from the last post, the training accuracy was nearing 90%. This disparity between training and testing accuracy is a result of overfitting. Essentially, 50,000 training loops was too much training for this little of data. The resulting network overfit to the noise inherent in the training data and, as a result, failed to generalize as well on the test set. Therefore, the testing accuracy can be improved if I were to retrain the network and conduct, say, 30,000 training loops instead.

Let's calculate the AUC score to really evaluate the performance of this model.
The AUC score for this network is 0.71. That's in the C-range, so we can consider this to be an okay, average-performing network.

Okay, so we have shown that neural nets have some utility as an identifier for heart disease. With some optimization and tweaking, the accuracy can be increased, but this exercise is fruitful in illustrating the power of neural networks.

As for this blog, unfortunately is has to come to an end. I certainly had fun writing it, and I hope that this blog was instrumental in spreading knowledge of neural networks. God speed.

Comments

Popular posts from this blog

Installing the Tools

We'll continue our descent by installing the tools necessary to conduct deep learning. The tools will include R, MXNet (framework for building neural nets in R), Python, and Tensorflow (framework for building neural nets in Python). You might ask why I'm using 2 different languages and 2 different frameworks. Truth be told, I like the way MXNet does classic, feed-forward neural network classifiers. You'll see that the syntax is concise and doesn't require as much fiddling with formatting of data. Unfortunately, MXNet doesn't exhibit the same elegance for more complex network architectures that we'll encounter later in this blog, so we'll use Tensorflow for CNN's (Image classification) and RNN's (time series classification). So let's install R. First, we'll go to  https://cran.r-project.org/bin/windows/base/ to download the latest version of R on Windows: We'll click the "Download R 3.4.2 for Windows" link to download R (...

An Introduction

Greetings, and welcome to my blog! In this blog, I’ll be illustrating the use of deep learning to solve various prediction tasks. For those of you that have never heard of deep learning, a proper introduction to the subject is in order. Deep learning is a specific type of machine learning that attempts to approximate a function through the construction of a mathematical model called a neural network. Basically, when this model attempts to “approximate a function,” this means that it maps a certain set of inputs to a certain output. It’d be helpful to illustrate what this “mapping” looks like by way of an example. For example, I’d like to identify what species a certain flower just by looking at the flower’s petal and sepal (green leaves underlying petals) length and width. If I were to attempt this with deep learning, I’d be constructing a model that maps petal and sepal length and width (the inputs) to a specific type of species (the output). This exact prediction task is w...

Classifying Flowers Part 1: Data

Everybody loves plants. So we'll continue our descent by building a neural network that can do something with plants. This construct will be able to take characteristics that describe a plant and, if we're good enough, hopefully the neural network will be able to tell us with accuracy what type of plant it is. To do this, we'll use the Iris flowers dataset, which contains 150 samples of 3 different species (50 samples each). The species in this dataset are Iris setosa, Iris versicolor, and Iris virginica. The dataset can be found at the following links. Data:  https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data ReadME:  https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.names Here's a screenshot of the data we'll be working with: Initially, this data doesn't look too exciting and if it at all confuses you, you're perfectly normal. But we can figure some immediate information just from looking at the format ...