Turn Dynamics CRM into a thinking machine

The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom

Isaac Asimov

As the saying goes wisdom is an asset of unmatchable importance, wisdom comes with intelligence. In computers, intelligence comes with extracting meaning out of data using Data Science. A little tinge of intelligence can turn an instruction-taking information system into an instruction-giving thinking machine.

In the previous post we discussed the idea to create an intelligent routing system in Dynamics CRM that can tell which Support Rep is best suited to resolve a customer ticket. If you missed the introductory post and the agenda, I recommend you to read it first to understand the following content better.

 

Prepare Dynamics CRM to marry Data Science

Before we start training our machine learning engine, we need to prepare our data to suit the data science algorithms better. We will use the following techniques

1. Classification using Support Vector machines : to find out what team/department the ticket belongs to

2. Logistic Regression: to predict the most suitable agent

 

We will train our Machine learning engine first using a supervised approach based on the existing tickets. In nutshell, it will understand the characteristics of various types of tickets and convert them into mathematical form, then predict by applying mathematical formulas on those characteristics. Some examples of these characteristics can be

  • Which Support Rep is better at handling certain kinds of customers
  • Which Support Rep generally resolves a ticket earlier than estimated
  • What are the traits of a ticket that belongs to certain category e.g. Investment Category

 

 

Let us see how our data looks like..

If you recall we are an advisory support organisation that primarily deals with Tax, Investment and Medical queries. Below is the how our historical ticket database looks like

image

 

It is all fictitious data. Neither the customers are real nor the Reps. But the ticket contents are realistic.

You cannot train a machine learning system with rubbish content, your samples have to be relevant to the domain for which you are building the ML model.

Data that will used by Data Science

Let me explain the fields

Description – This is email or phone transcript from the customer which contains the queries/questions and problem definition of the ticket

Department – The Department to which the query belonged to. In the past it was manually set by Tier 1 Agent, but now our system will predict it automatically

Type – It is the industry sector / vertical of the Customer. It will used as well in the algorithm, which I will explain the upcoming posts

Support Rep – The Rep who worked on the query

Estimated Time – ETA given by the Support Rep before starting work

Total Time Spent – Actual time taken by the Support rep to perform work before moving to next query

Architecture

Below is a view of our Intelli-routing engine that shows how the engine will fit inside CRM and integrate with Machine Learning WS

image

 

Its self explanatory, basically I will build my engine using Python. It can be deployed in Azure Machine Learning  (as it supports Python). But my Azure access has expired so I will use another provider to host my web service.

 

In the next post we will start building our Intelli-routing model in Python and train the classifier.

Advertisements

2 thoughts on “Turn Dynamics CRM into a thinking machine

  1. Hello.
    I am trying to Integration of Dynamics CRM with the prediction service by using plugin. below is part of code where i am getting an error.
    if (entity.Attributes.Contains(“description”))
    {
    var url = “https://asiasoutheast.services.azureml.net/workspaces/XXXXXXXXXX”;// Here i have replaced with correct url.
    var apikey = “kjekje”;// Here i have replaced this with API Key
    string predictedDepttResult = “(default)”;
    var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
    httpWebRequest.PreAuthenticate = true;
    httpWebRequest.Headers.Add(“Authorization”, “Bearer ” + apikey);
    httpWebRequest.ContentType = “application/json”;
    httpWebRequest.Method = “POST”;
    using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
    {

    string rawDesc = (string)entity.Attributes[“description”];
    rawDesc = EncodeJson(rawDesc);
    string json = “{\”descp\”:\”” + rawDesc + “\”}”;
    streamWriter.Write(json);
    streamWriter.Flush();
    streamWriter.Close();
    tracingService.Trace(“2”);
    var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); // I am getting an error here
    //throw new Exception(“Result : success”);
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    {
    // tracingService.Trace(“3”);
    predictedDepttResult = streamReader.ReadToEnd();
    }
    // tracingService.Trace(“4”);
    }

    I am getting an error at below line
    var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    The description of error is :
    System.Net.WebException: The remote server returned an error: (400) Bad Request.

    Please Help to resolve this.
    Thanks,
    Rinkesh Rathore

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s