Integrating ML with RPA using AI Fabric

Tom Jeffries
Datasparq Technology
4 min readFeb 24, 2021
What pops up when you Google image search for Robotic Process Automation

Recently I assessed Ui Path’s artificial intelligence service, AI Fabric, and to be more precise, implement a basic Natural Language Processing (NLP) classification model within AI Fabric. This project had two sides, understanding AI fabric and all of its quirks, and creating my first ML model in python.

A quick aside on the model required. This was my first ML project that I had undertaken; creating TF-IDF features on a set of german email complaints with the goal of classifying the type of complaint within the text — a simple NLP problem. Using the normal techniques of stemming, stop words and vectorizing, I was able to create features which could then be used to train a Naive Bayes model, as described in many online guides.

However, the task was not only to create the model, but to deploy it to AI Fabric in order to demonstrate the capabilities of ML in Robotic Process Automation (RPA). The platform provided by Ui Path proved to be very easy to use, allowing for quick data uploads, and even had numerous ‘out of the box’ ML models available. There are still a few teething issues with some of the models at the time of writing, such as environment variables not able to be set at run time. However, what is particularly useful in AI Fabric is that a zip package with python scripts for training and predicting can be uploaded, along with any untrained model that is desired.

The zip package that is uploaded must be in the required format as specified in the AI Fabric documentation.

A new ML Package can be created from an uploaded zip file of bespoke code, or an Out of the box Package

As per the documentation, AI Fabric looks for a class, Main(), in both main.py and train.py. The class has the required functions to train, test and predict. When training and testing the model, it is useful to export information so that it can be reviewed to see the results of the new model. This can be done by creating an artifacts folder which text files and graphs can be saved to. This is a great feature within AI Fabric, with each run creating its own artifacts folder, allowing for in-depth metrics and information to be saved and viewed later.

I would recommend rigorous testing locally when creating the model. AI Fabric is easy to use once the code is uploaded, however the process of making a change, compressing all the code to a new folder and uploading the zipped folder is a time-consuming process. If there are any errors when deploying or running the code, ML Logs is very useful, and will highlight any errors just like whichever IDE you use.

Once all the working code is assembled, the zip can be uploaded to AI Fabric. Within a project, the ML code can be uploaded in the ‘ML Packages’ section, along with any information for the model. Here it is validated, checking that the correct scripts and requirements are available. Once complete, a pipeline can be run. There are three types of pipelines; train, evaluation and full. A full pipeline is just a combination of both the train and evaluation pipeline, allowing the model to be trained and tested in one run.

Creating a train pipeline for an uploaded model

The model, version (1.0 if the model has not been trained before) and data must be selected for each pipeline. A train pipeline is used to create a new version of the model (i.e v1.0 is trained to v1.1), and an evaluation pipeline is created to test the model. If a completely new version of the model is created, it can be uploaded to the same ML package, and creates a new major version (v2.0).

Deploying an ML Skill, a trained machine learning model which can be dragged and dropped into Ui Path

Once the model has been trained, it can be deployed to Ui path for implementation in an RPA stream. An ML skill must be created but once it is fully deployed, it becomes available in Ui Fabric, as long as you are on the same Orchestrator Service. Here it can be easily dragged and dropped into any workflow, just like any other process.

Now, the powers of AI can be unlocked in RPA. At a first trial, this simple classifier can be implemented to divert email complaints with a high level of success (80–90% accuracy with limited data). However, this is very similar to the ‘out of the box models’ mentioned earlier. These models work fine, and can be easily implemented, however the beauty of the bespoke packages are their customisability. For example, the percentage confidence can be returned with each classification, allowing human intervention to be called if the confidence is below a set threshold.

With this package structure, more complex models can be implemented as needed by the use case. For example, random forest or gradient boosting algorithms can be utilised to complete tasks effectively and increase the productivity of any business. Some backend work is still required, of course. Some fine tuning of the model input parameters for specific tasks may be needed, as each job is different, but any ML package can be easily uploaded, trained and deployed in a few simple steps on UI Path.

--

--