Anomaly Detection Shiny App

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


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

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

Hasham Khan November 23, 2017
Great work Kyle! Could you please share the code? Thanks, Hasham
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 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans 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 boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis 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 seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI