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 (...