Machine Learning in Digital Process Automation — Part II

Ralf Mueller
Oracle Developers
Published in
9 min readSep 6, 2019

In this second part of the ML in Digital Process Automation article series, we focus on how to consume a Machine Learning Model created in Autonomous Data Warehouse (ADW) for scoring in Integration Cloud Processes. It is assumed that the reader is familiar with the content of Part I. For this article we assume an existing ML model stored on Object Storage. We will give step-by-step instructions on how to bring such models into Oracle Integration Cloud and use them in process automation.

Curve (Image © Ralf Mueller)

By the time of this writing, the Machine Learning functionality for Integration Cloud Process Automation is in “Limited Availability” mode and must be enabled by a feature flag. Please get in touch with your Integration Cloud representative to get this feature enabled for your Integration Cloud instance.

OML Micro-Services

Oracle Integration Cloud comprises of a new set of micro-services for Machine Learning and Artificial Intelligence, the Oracle Machine Learning (OML) micro-services developed by the OML team in Oracle Advanced Analytics organization as part of the Oracle Machine Learning Platform. We will give an in-depth overview of OML micro-services in a later article, for now, it is sufficient to understand the functionality coming with OML micro-services

  • Cognitive Text Services
    Cognitive Text Services provide Machine Learning functionality for Text Classification, Keywords, Summary, Similarity, and Sentiment Analysis. The underlying ML models are pre-trained by Oracle and can be used out-of-the-box. Typical examples in digital process automation include giving a summary of a large text document or give sentiment on customer input.
  • Cognitive Image Services
    Cognitive Image Services provide Machine Learning functionality for Image Classification, NSFW content and Image Similarity. Like with the Cognitive Text Services, the underlying ML models are pre-trained by Oracle.
  • Model Repository Service
    The Model Repository Service manages ML models created with Autonomous Database and saved in Object Storage or local file system. Once an ML model is uploaded to Model Repository Service, it can be enabled as a service for scoring using Model Deployment Service. Please note that the ML Models can be created with any Oracle Database of version 18.3 or later, including on-prem databases. That enables a broad range of options for ML model training. In this article though, we mostly use Autonomous Database as the basis for ML model training since Autonomous Data Warehouse offers an ML notebook user experience for model training and data visualization.
  • Model Deployment Service
    The Model Deployment Service manages the lifecycle of Machine Learning Services. ML models uploaded to Model Repository Service can be service-enabled in Model Deployment Service for the scoring of data against their underlying ML models.

OML micro-services are multi-instance (or multi-tenant) services deployed to Container Engine for Kubernetes (OKE) in each Oracle Cloud Infrastructure (OCI) region.

It is important to understand that once a ML Model is uploaded to OML Model Repository Service, Autonomous Database is NOT needed for scoring against the ML Model. The scoring is performed by OML Model Deployment Service, which offers low latency and high throughput scoring functionality.

Machine Learning Services in Process Automation

In this chapter, we give a detailed description of how to bring Machine Learning Models created in Autonomous Database and saved to Object Storage into OML Repository Service. Once an ML model is uploaded to Model Repository Service, it can be used for scoring in Integration Cloud.

Machine Learning in Process Application palette

We added a new first-class Machine Learning entity to the Process Applications palette for the management of Machine Learning Models and Services.

The interaction with the OML Model Repository and Deployment Service is managed via this new User Interface.

Other first-class entities for process applications include Processes, Forms, Business Types, Decisions, Integrations, and Indicators.

Upload ML Model to Model Repository Service

Below image shows the content of a bucket in Object Storage containing a couple of ML Models that have been created earlier in ADW and saved to Object Storage from OML Notebook(s).

Machine Learning Models stored as objects in Object Storage bucket (.mod files)

In order to use an ML model in Integration Cloud, you have to first download the model to the local filesystem which can be easily done from Object Storage as shown in the image below.

Download SalesClassificationV2.mod to a local file system

In a next version of Integration Cloud we add a User Interface that allows direct consumption from ML Models in Object Storage. For now, they have to be downloaded to local file system first.

Next, we can go to the Machine Learning palette in Process Applications and start using the ML model in your application. This will open below screen from where you can manage the Machine Learning Models and Services used in the process application.

Click on the Use button and select Add to add a new ML Model to the application.

Available ML Services to use in Process Applications
Adding a new Machine Learning Model from local file system

and then pick the downloaded .mod file from local filesystem

Choose File from the local filesystem

Once added, you can choose to use this model in your application by clicking on the Use button.

That’s it, your newly added ML Model is ready to be consumed in Process Applications.

Use of ML Services in Process Applications

Now that we have uploaded an ML Model to OML Repository Service and activated it as an ML Service in OML Deployment Service, we can use the service to score against the ML Model.

Below image shows a sample Approval Stage within a Sales Approval Dynamic Process. For now, we will just show on how to use an ML Service in a process, in the next part we’ll do end-to-end modeling of the process with a detailed explanation of each step.

Sample Approval Stage with a SalesVPApproval Task

We’d like a Sales VP to approve the order in the case where scoring the Sales Classification Model would result in a label “no” with probability greater than 80%. This can be modeled quite easily: Select the SalesVPApproval activity in the process and then add a Data-Driven Activation Condition for the task.

Configuring a Data-Driven Activation Condition for a Task using ML Services.

After you configured the Data Condition you might want to save it, the task then shows up like this in your process diagram

SalesVPApproval task with Data-Driven Activation Condition consuming an ML Service

There are many things happening under the carpet at runtime for above task configuration, so a bit of explanation is required here

  • As part of the execution semantics for Sales Approval Process, the process runtime will activate task SalesVPApproval at the moment where Stage ApprovalStage is activated.
  • As part of activating task SalesVPApproval, the following happens
  • SalesVPApproval has an Activation Condition, so prior to executing the task, the Activation Condition must be evaluated. Only if the Activation Condition evaluates to true, the task will be executed
  • As part of evaluating the Activation Condition for task SalesVPApproval, the Machine Learning Service SalesApprovalClassification will be invoked for scoring with the modeled input and output
  • After the Machine Learning Service returns a result, the modeled conditions will be evaluated. In the above example, the condition is something like if label == “no” AND probability > 0.80
  • If the condition evaluates to true, the task (in this example a User Task) will be executed, otherwise not.

Another way to consume Machine Learning Services in Process Automation is by using a Machine Learning Activity in the process as shown below. We added ML Activities as first-class activities in Processes. Think of them as Service Tasks that take an input, execute the ML Service behind and create output

Using a Machine Learning Activity in the Process

After selecting the ML Activity, click on the ‘+’ button to create the activity in the Process model.

Machine Learning Activity in-process model.

The activity can then be edited just like any other activity in the process. For the Machine Learning Activity, this includes

  • Selection of the Machine Learning Service to use for this activity.
  • Specification of the Machine Learning operation to use. For custom ML Services, the only available operation is to score against the ML model. For the Cognitive Image and Text Services, a variety of operations is available.

To complete the activity, data associations for input and output must be configured.

For the data mappings required, we are still working on better user experience with full auto-completion and visual support. For now, here’s how the data needs to be mapped. When an ML Service is created for a Process Application, new Business Types are created that correspond to the input and output of the configured ML Service.

Input Data Mapping

For the input part, a data object must be created that is of type OracleMLModels.<MLServiceName>.<MLServiceName>_INPUT_TYPE

and this data object can be assigned a value in the process and used as input for the ML Service. In the above example, data object saIn is of such type and assigned to the (input) body of the chosen ML Service. In a Machine Learning task of the process, the data object can be used in the input data association of the task.

Output Data Mapping

For the output, it depends on where the output is used. When the output is used in a Data Condition, there is an implicit (output) body element created automatically which corresponds to the output of the chosen ML Service. The body element is of complex type and in the example above contains the following elements for mapping

body.scoringResults[1].classifications[1].label 
body.scoringResults[1].classifications[1].probability

When the output is used in a Machine Learning Task, then a data object must be created that is of type

OracleMLModels.<MLServiceName>.<MLServiceName>_OUTPUT_TYPE

and this data object can then be used in the output data association of the Machine Learning Task

The structure of the output depends on the type of Machine Learning model. For a classification model, this includes the label and probability of the label. Other types of Machine Learning models create different output. A detailed description of this will be subject for a future article.

That's it, quite easy isn’t it? This capability adds a lot of power to process automation and we will look into some more complex examples and other uses of ML Services within Integration Cloud in future articles of this series.

Conclusion

We have demonstrated the use of Machine Learning Models for Digital Process Automation from beginning to end. While the first two parts of this series give a basic overview we’ll focus on more use cases of ML in the next couple of articles. The goal for the first two articles was to introduce Autonomous Data Warehouse and how we can use OML notebooks to train ML models and store those on Object Storage and then bring those models into Integration Cloud, enable them as Services and use those ML Services for process automation.

Thanks for reading all the way through, stay tuned for more articles in the Machine Learning for Integration Cloud series.

--

--

Ralf Mueller
Oracle Developers

Software guy, photography enthusiast. I work for Oracle Corporation, opinions expressed here are my own.