Mathematically, any observation far removed from the mass of data is classified as an outlier. In practice outliers could come from incorrect or inefficient data gathering, industrial machine malfunctions, fraud retail transactions etc. So it becomes essential to detect and isolate outliers to apply the corrective treatment. You can use Spotfire to smartly identify and label outliers in the following ways:
1. Use a box plot
Box and whisker plot (box plot) shows the relationship between a numerical y-variable and a grouping x-variable by using the five number summary - minimum, first quartile (Q1), median, third quartile (Q3), maximum. In addition to the above Spotfire provides lower adjacent value (LAV) and upper adjacent value (UAV) defined as follows
LAV = Q1 - 1.5 * IQR
UAV = Q3 + 1.5 * IQR
Where IQR is interquartile range. Any point falling outside of LAV and UAV are marked as outliers. The tooltip label includes additional information about the outlier which is different compared to all other data points in the plot.
2. Configure other plots
Other plots from Spotfire quick access menu that are commonly used to identify outliers:
- Bar Chart in histogram configuration to identify univariate outliers
- Scatter plot in QQ plot configuration to identify bivariate outliers in distributions
- Combination plot in Pareto chart configuration to identify outliers based on cumulative value
- Parallel Coordinate Plot (PCP) multivariate analysis for outlier detection
3. Through Data Panel Histogram
The column overview data panel for in-memory as well as in-db data shows a histogram of distribution for numerical columns.
Users can also insert custom lines for isolating outliers in multimodal data. Consider the case of data from a standard normal distribution - about 5% of the data falls beyond 2 standard deviations and thus will be picked up as outliers by common statistical tests. But this is just the nature of the distribution that the points follow. For such cases Spotfire allows you the flexibility to insert lines from custom expressions without depending entirely on predefined methods of outlier detection.
Fig. shows histogram with outliers identified as points beyond 2 std. deviations from mean
4. Select Column Aggregation Functions
The y-variables for visualization types available in Spotfire can be aggregated to display Outlier Counts, Percent Outliers, Percentiles and Quartiles. These measures can be passed to configuration properties like color schemes described in point number 6 below to visually separate outliers from the rest of the data.
5. Use TERR to detect outliers
Custom expressions, Expression functions and Data functions, all allow the user to extend Spotfire capabilities by seamlessly integrating it with 10,000+ packages from CRAN using TERR or Open Source R. An example of combining the TERR expression with color could be to choose gradient color scheme based on outlier scores calculated by one line expression:
outlier.score <- Rlof::lof(datacolumn, k=5)
Here Rlof package contains lof function which is an implementation of widely used Local Outlier Factor algorithm to detect outliers. These scripts map Spotfire data elements (tables, columns, properties etc) to R function inputs and can be saved and reused across columns, visualization configurations etc. Such flexibility and extensibility in Spotfire is unmatched by any market contemporaries.
For more extensive analysis like Mahalanobis distance analysis for Outlier Detection, TERR Data functions can be leveraged. Output from the data functions can be automatically plot onto interactive, brush-linked visualizations.
6. Enable Color Scheme Rules
Outliers can be smartly identified using dynamic outlier color schemes based on dynamic rules that the user can enable. These rules include:
- Exclude Outlier color scheme in predefined color schemes
- Simplest conditional inbuilt color options for points lesser than the Lower Inner Fence or greater than Upper Inner Fence
- Threshold by mean, median, custom user specified expression
- Use gradient color scheme with dynamic Outlier Scores created in TERR as above
7. Leverage Curve Fit or Regression
Lines and Curves in Spotfire visualization properties lets you insert a curve fit or a line fit to the data. This fit can then be used to identify extreme deviate points i.e. outliers!
8. Similarity or Clustering
Spotfire provides out of box functionality to apply Line Similarity and K-Means clustering to visualizations from the Tools menu. The user can choose the similarity metric - Euclidean or Correlation and other parameters like number of clusters to create line similarity or Clustering label column in the data. This column can then be used to color or trellis options.
Stable number of clusters can be found by applying Hierarchical clustering on the data. Hierarchical clustering is also available from the Tools menu in Spotfire and results in heat map visualization with dendrogram based on distance metric. Sliding the cutoff point to desired position in the dendrogram helps decide stable number of clusters.
Fig. shows out of box Kmeans clustering on data. Grey line in Empty cluster is outlier.
If the data has outliers they will fall into their own cluster, for number of clusters greater than the stable number.
9. Explore advanced Configurations
We discussed creating new calculations and columns with expressions, expression functions and data functions. These can be connected to configuration options that automatically label outliers. Advanced configurations from visualization properties extend beyond the color feature and can be applied similarly to markings, filters, subsets and labels across visualizations.
10. Templates on Community Exchange
To aid the Citizen Data Scientist, Spotfire Data Science team makes available for free several plug-and-play templates on community.tibco.com/extensions under the ‘Analytics’ tag. These templates allow the user to plug in their data with the push of a button and explore the insights with minimal configuration.
Anomaly detection using deep learning neural nets is one such template that analyses the input data to find anomalies based on recreation error during unsupervised learning. Another domain specific use case is Quality control template that identifies violations or outliers from the established control limits of the individual points, the moving average and variance. These templates allow the user to extend the definition from a common outlier to a domain specific outlier and smartly identify and label the same.
How do I learn more?
This summarizes briefly top 10 methods for outlier detection. Watch the page and vote up to get notified about detailed updates. You could also request a featured session on any specific method from above on Dr. Spotfire by:
- Tweeting your question with the hashtag #DrSpotfire
- Posting your question to the TIBCO Community "Answers" section with the hashtag #DrSpotfire
- Contact Dr. Spotfire directly at firstname.lastname@example.org
- Adjacent Values and Outliers
- Custom expressions and Expression Functions in Spotfire
- How to configure Pareto chart from Combination chart in Spotfire
- Shewhart Control Charts & Trend Charts in Spotfire
- Clustering made simple with Spotfire
- TIBCO Community Exchange for Analytics
- Anomaly Detection with Autoencoder Machine Learning Models Wiki page