Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

ReliabilityTools

Guides

  • Reliability Tools

Tech Notes

  • Outlier detection for financial time series

Symbols

  • AnomalyDetectionInterface
  • AnomalyFinder
  • CrowAMSAAForecast
  • GNNMonAnomalyDetection
  • GNNMonAnomalyDetector
  • GrowthTrackingPlot
  • IngestSeeqData
  • IngestXMLData
  • SimpleAnomalyDetection
Outlier detection for financial time series
Data
Via geometric nearest neighbors
XXXX.
Data
Here is a time series and its length:
In[1]:=
tsData=FinancialData["GE",{{2019,1,1},{2024,1,1},"Week"}];​​Length[tsData["Path"]]
Out[2]=
261
Here is a date list plot with a vertical grid line that marks the training and testing split date:
In[15]:=
splitDate=DateObject[{2022,1,1}];​​pl=DateListPlot[tsData,AspectRatio1/3,ImageSizeLarge,PlotLabel"GE stock",GridLines{{splitDate},Automatic}]
Out[16]=
Via geometric nearest neighbors
Here we split the data into training and testing parts:
In[17]:=
splitPos=Length@Select[tsData["Times"],#≤AbsoluteTime[splitDate]&];​​{training,testing}=TakeDrop[QuantityMagnitude[tsData["Path"]],splitPos];​​Length/@{training,testing}
Out[19]=
{157,104}
Here we get the positions of the anomalies:
In[20]:=
pos=
GNNMonAnomalyDetection
[training〚All,2〛,testing〚All,2〛,"AnomalyPositions","NumberOfNearestNeighbors"10];​​Shallow[pos]
Out[21]//Shallow=
{1,2,3,4,5,10,11,12,13,14,50}
Here is a plot of the time series and the found outliers:
In[22]:=
Append[pl,Epilog{Red,PointSize[0.012],Point[testing〚pos〛]}]
Out[22]=
RelatedGuides
▪
Reliability Tools
​
""

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com