Anomaly Detection Shiny App

Kyle Szela
Posted on May 16, 2016

Contributed by Kyle Szela. He is currently in the NYC Data Science Academy 12 week full time Data Science Bootcamp program taking place between April 11th to July 1st, 2016. This post is based on his second class project - Shiny App (due on the 4th week of the program).

Introduction:

My initial idea for a shiny app was to take ECG data (the recordings of electrical and muscular activity of the heart) and apply anomaly detection with seasonal periodicity taken into account.  Unfortunately, the mutation of the dataset into an acceptable time series proved extremely difficult.  So difficult, that I wanted to make it easier for others to be able to perform this time series anomaly detection easily.  The end result is an app that will take in a dataset and attempt to perform the associated anomaly detection algorithm despite time series data that is not easily cast to a R compatible format.

Uploading and Viewing the Dataset:

The first tab, shown below, allows for the uploading of a dataset into the app.  It allows the user to specify the inclusion of the header, the delimiter, and the type of quotation of the .csv file.  The user simply clicks the "Choose File" button, finds their csv file, and uploads it.

Once the dataset is uploaded, the app will attempt to cast the first column into a timestamp format.  If it is not able to do this, it will cast the sample number into a time series, instead, and will display the old data as a third column.  The corresponding time series graph will be presented in the "Data Chart" section, while the csv data will be presented in table format in the "Data" section.

Screen Shot 2016-05-16 at 7.10.23 PM

Performing Filtering:

The next tab allows the user to filter his or her data with either a Butterworth or a Type-II Chiebyshev filter.  The idea behind these filters is that they allow the user to partially select the different anomalies to detect, as well as remove noise from the dataset and aid in the visualization of the time series data.  Choosing not to filter the data will not remove the ability to perform the time series anomaly detection.  I've found that the Butterworth filter does a pretty great job of smoothing out the dataset.

Screen Shot 2016-05-16 at 7.15.27 PM

Anomaly Detection:

The last tab allows the user to detect anomalous points in their dataset.  In the "Settings" section, there are a few different options for the user to choose.  The "Max % of Anomalies" refers to the maximum number of anomalous points to be found, as a percentage of the total data set.  The "alpha" refers to the statistical significance required for each point to be considered an anomaly.  Lastly, the "Direction" radio buttons allow the user to choose if they would like to find only the positive, negative, or both directional anomalies.

Once the user has selected their settings, and the "Filter" button has been pressed, a graph is displayed in the "Data Chart" section that affords the ability to pinpoint the individual anomalous points in the time series.  Additionally, these points will be presented in table format in the "Data" section, and are available for download.

Screen Shot 2016-05-16 at 7.24.02 PM

About Author

Kyle Szela

Kyle Szela

A recent graduate from Northwestern University with a B.S. in Computer Science, Kyle has a strong background in computer engineering and programming concepts. His previous work and academic studies contains a panoply of topics including machine learning, artificial...
View all posts by Kyle Szela >

Related Articles

Leave a Comment

Avatar
Hasham Khan November 23, 2017
Great work Kyle! Could you please share the code? Thanks, Hasham
Avatar
Shahid Ali October 26, 2017
Hi Kyle Szela , Really impressive post. I'm working on this project can you please send me source code of this project.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp