UiPath AI Fabric Hands-On Exercise & Tutorial 2020

(Part 2- Complete Working Example with Out of Box ML Models)​

In this part of article, I’ll cover-

  1. How to use your deployed ML Skills into Project (Continue from last article)
  2. Consuming an ML Skill in UiPath Studio
  3. Working example of Google Apps Comment Sentiment Use Case
  4. Building Task for Human to validate using form activity
  5. GitHub Project Repo to play around code.

Pre-Requisite

You will need –

  1. UiPath Studio v 2019.10+, with UiPath Robot v 2019.10+ and UiPath Orchestrator 20.4
  2. AI Fabric Enabled Orchestrator Instance (You can request for Free Trail for Enterprise Edition)
  3. Licence for AI Robot 
  4. Already deployed ML Project in AI Fabric for Consuming an ML Skill in UiPath Studio

Starting Point

Your good starting point could be already developed code. Which you can download form my Git Hub repo.

This repo contains working example of  sentiment analysis Out of Box ML Packages to review the comments of android apps on Google play store.

Project Dependency

Below are the minimum set of Activities you need to enable for working with ML Skills. 

  1. UiPath.MLServices.Activities
  2. UiPath.Persistence.Activities
  3. UiPath.System.Activities
  4. UiPath.UIAutomation.Activities
  5. UiPath.WebAPI.Activities

You might need other activities based on changes you wish to do into project such as writing result back to excel file.

Input Data

For this example, we have used the data set of 10000+ Android Apps and their Review for explaining the various operation. You can download from below.[Source Kaggle]

googleplaystore_user_reviews:: App,Translated_Review,Sentiment,Sentiment_Polarity,Sentiment_Subjectivity

Project Structure

The Project is created with simple workflow without using re-framework. It has 5 Workflows for different tasks.

  1. Init – In this workflow, the Dataset (Google Apps Comment CSV) file is read and stored into data tables for easy handling.
  2. Get_Next_AppReview – In this workflow, logic is applied to read 1 comment at a time and loop over the data tables.
  3. Classify_App_Review – In this workflow, ML Skill is invoked using given input and Output JSON  is deserialised to get the required columns from the dictionary object.
  4. Save_And_Move_To_Next – In this workflow; I have saved the results as write line activity, You can modify this to store in data tables or pass this to another workflow for post-processing.
  5. Main- Its flow chart based workflow and ties all the above components together. 

We have also implemented, Human in loop validation in Main Block. We will discuss that in the next section.

 

UiPath AI Fabric Tutorial | How to Use ML Skill in UiPath Studio 3

Consuming an ML Skill in UiPath Studio

  • In UiPath Studio, drag and drop the ML Skill Activity into workflow.
  • Select the Refresh ML Skills option to populate the drop-down list with all the successfully deployed ML Skills from the AI Fabric tenant.
  • Pass the data to the input of the ML Skills exactly as we would with any other activity.
  • The ML Skill also allows to live test an input by selecting Test Skill.
  • Once deployed as ML skills, models can be used with regular UiPath Robots (attended or unattended).
Get Prediction from AI Fabric
The ML Skill also allows to live test an input by selecting Test Skill.

Human in Loop

This example also uses the concept of ‘Human in Loop’.

The Bot is designed in such a way that it compares the Confidence score of the ML Skills with pre-configured value.

If the confidence score is low, Bot creates a task in the action centre in Uipath Orch.  

As this will be working as an Attendant Bot, WOrkflow will stop and wait for the action to be completed by ‘Human in Charge’ and save the corrected data as output.

This workflow can be further enhanced to pass corrected data to ML Skill for retraining. 

Once  Action has been validated, Bot will resume its processing for the next item in the pending list.

UiPath AI Fabric Tutorial | How to Use ML Skill in UiPath Studio 4

How to Create a Form Task. 

UiPath.Persistence.Activities.FormTask.CreateFormTask 

The Persistence Activities pack has been developed as part of the Human In The Loop initiative, offering you several activities that help you manipulate Jobs, Tasks, and Queues in Orchestrator.

for designing form task, All you need to do is Use ‘Create Form Task’ Activity. You need to map and Build Form Data which will be used as INPUT/OUT which you want to display in a form within the orchestrator task inbox.

Modifying OUT and IN/OUT arguments maps them back to the workflow after task completion. 

 

After that; You need to add  UiPath.Persistence.Activities.FormTask.WaitForFormTaskAndResume  Activity to suspend the execution of the current workflow until a specified Task is completed.

You can play around various properties to configure as per your need.

Task for Human Validation

Related Blog Post links –

  1. UiPath AI Fabric Tutorial | Build Your ML Based RPA Project [Part 1]
  2. UiPath AI Fabric Tutorial | How to Use ML Skill in UiPath Studio [Part 2- This Article ]
  3. UiPath AI Fabric Tutorial | How to Deploy Own Model in AI Fabric [In Draft facing some challenges with the deployment will post soon ]