Friday, January 21, 2022

#898 - OCI Anomaly Detection Service & OIC - Part I


 







Oracle Cloud Infrastructure (OCI) Anomaly Detection is an AI service that enables developers to more easily build business-specific anomaly detection models that flag critical incidents, resulting in faster time to detection and resolution. Specialized APIs and automated model selection simplify training and deploying anomaly detection models to applications and operations—all without data science expertise.

Read more about OCI Anomaly Detection here

My starting point is the workshop, which can be found here


The workshop is very easy to follow - essentially you have the following artifacts -

  • Projects - for organizing your work
  • Data Assets - links to the data sources which will be used as the basis for anomaly detection.
  • Models - ML models trained to detect anomalies. Models leverage Data Assets for the base data.
  • Detection - you can upload a file and test it against the model, or else you can leverage the Anomaly Detection api for this. We will be using the latter, in respect of OIC.
So now to the simple workshop example - the starting point is a .csv file containing sensor readings - 










We have a timestamp column and then 5 temperature and 5 pressure readings columns.
You get the drift about which anomalies we'll be looking for here. Please note that the Anomaly Detection Service currently only supports time series based data sets, hence the timestamp column.

Ok, I upload this .csv file to object storage and then create a Data Asset in Anomaly Detection.

The menu is very simple -


 

























Now to the Model - 

















It's that easy! No take some quality time out while waiting for the model to be trained. 


















Let's do some detection - the lab provides the following test file - 













Sehr gut! as we say in Franconia. Next let's look at the Anomaly Detection API.



Now I use OIC to invoke a couple of these - first to creating the connection...


Create an OIC connection to Anomaly Detection Service
















Configuring the AD REST adapter in an Integration 

Here is the configuration of the REST invoke - 






















Note how I define the response as {}, as I do not have an example for the response. I use this to execute the invoke the first time and then replace with the actual payload returned.


 






















I add a loop and then log the model names -






















Here is the output - 


I have output the model name and it's id (ocid). Currently there is no public REST api at this level to invoke the Detect Anomalies operation. However, the lab does provide a python client for doing this. I will look at invoking this client in the next post in this series.My idea is to create the relevant python function in OCI Functions and invoke it from OIC - 







 



























No comments:

Post a Comment