R Deep Learning Projects: Master the techniques to design and develop neural network models in R by Yuxi (Hayden) Liu & Pablo Maldonado

R Deep Learning Projects: Master the techniques to design and develop neural network models in R by Yuxi (Hayden) Liu & Pablo Maldonado

Author:Yuxi (Hayden) Liu & Pablo Maldonado [Liu, Yuxi (Hayden)]
Language: eng
Format: epub
Tags: COM037000 - COMPUTERS / Machine Theory, COM018000 - COMPUTERS / Data Processing, COM062000 - COMPUTERS / Data Modeling and Design
Publisher: Packt Publishing
Published: 2018-02-21T23:00:00+00:00


Distribution of reconstruction error in the test set

From the plot, we see that we can set up the threshold value at 15, that is, observations with a reconstruction error above 15 would be marked as outliers:

threshold <- 15

y_preds <- sapply(error, function(x) ifelse(x>threshold,"outlier","normal")})

Once this is done, we can calculate the confusion matrix. This is a useful way of visualizing what the model is doing:

# Confusion matrix

table(y_preds,y_test)

This gives us the following:

y_test

y_preds normal outlier

normal 5707 496

outlier 3265 532

So clearly we could do better. Perhaps the vertical stroke shared by digits 1 and 7 contributes to the huge error rate. We caught, however, a bit over 50% of the outlier cases with this simple architecture. One way to improve this would be to add more hidden layers. We will use this trick later in this chapter.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.