rhondamuse.com

Harnessing Machine Learning and NLP for IT Support Ticket Prediction

Written on

Chapter 1: Introduction to Machine Learning in ITSM

Are you handling a large volume of IT service requests? Interested in minimizing operational expenditures? Seeking to improve user satisfaction? If so, this guide is tailored for you.

This article outlines the steps for data science enthusiasts to implement production-ready Machine Learning solutions within the IT Service Management (ITSM) framework. The proposed ML approach provides insights into IT service requests and integrates ITSM strategies across various business divisions.

We will employ a supervised classification algorithm to categorize incoming tickets based on the text provided. While I will utilize Python, a RESTful API framework, along with Scikit-Learn and SpaCy, numerous alternative solutions may suit your organization more effectively. I aim to highlight opportunities for variation while justifying my chosen methodologies.

Susan Li offers an insightful introduction to Machine Learning for Text Classification using SpaCy. Her work has significantly influenced my process, code, and demonstrations presented here. I encourage you to subscribe to her channel if you find my content valuable.

The final model achieves over 85% accuracy in predicting the categories of all tickets entering the production environment, halving SLA response times and leading to nearly $600,000 in annual cost savings.

Chapter 1.1: The Importance of IT Service Management

IT Service Management (ITSM) is a critical organizational function that utilizes innovation to drive value, enhance user productivity, and provide comprehensive tech services. Despite its significant role, interactions with IT support can often involve lengthy and cumbersome conversations via web or phone. Whether you're requesting a password reset, submitting application configuration changes, or seeking assistance, the experience can often be frustrating. The challenge arises because IT leaders find it difficult to adequately staff and support a holistic help-desk management system for the entire organization.

Even with good intentions, support teams frequently struggle with efficient ITSM. In a recent project for a global medical device client, I was tasked with addressing the challenges surrounding enterprise incident ticket triage. Leadership opted to invest in an expensive legacy solution using ServiceNow (a well-known ITSM workflow platform) and an external vendor to enhance response times, but with little success. The rigid SLA requirements and generalized usage led to inaccuracies, causing tickets to bounce around among business groups. Users were frustrated, support staff were overwhelmed, and leadership was left perplexed.

In 2019, over 60,000 tickets were submitted to my client's ServiceNow platform, targeting nearly 15 different business units. Each ticket incurred a cost of $13 for the IT organization, yet the average accuracy score for reaching the intended destination was only 40%. Misassigned tickets lingered in the system for an average of 21 days before being properly directed. The issues of cost, delay, and accuracy resulted in poor user experiences.

When a user submits a support ticket, it enters the system via email, phone, or an embedded portal. Each ticket includes a description of the issue or request, which a support professional quickly reviews before passing it along. Once the appropriate assignment group receives the ticket, some amount of work gets completed, and the ticket is eventually marked as closed.

This situation presents a prime opportunity for Multinomial Classification through Supervised Machine Learning to categorize support tickets according to a defined set of business groups. We can efficiently extract text and category data from each ticket and train a model to associate specific words and phrases with designated categories. My hypothesis is straightforward: machine learning can yield immediate cost savings, improved SLA results, and more accurate predictions compared to human efforts. Let's dive in!

Chapter 1.2: Data Collection and Analysis

Before selecting and training our machine learning models, we must first analyze the data to identify trends in incident tickets. ServiceNow offers a robust Table API framework that enables us to extract data directly from the platform.

# Import Statements

import requests

import json

import pandas as pd

# Initialize url

# Set simple authorization

user = "{username}"

pwd = "{password}"

# Set proper headers

headers = {"Content-Type": "application/json",

"Accept": "application/json",

"accept-encoding": "gzip, deflate, br"}

# Initialize GET response

response = requests.get(url, auth=(user, pwd), headers=headers)

data = json.loads(response.text)

dataframe = pd.DataFrame(data['result'])

ServiceNow's embedded API Explorer facilitates an in-depth exploration of RESTful API tuning, allowing users to create custom API requests easily. You can access popular tables (like incident and task) or formulate complex queries, making it a valuable tool for data professionals.

As we focus on linking text to relevant classifiers, we can leverage a categorical variable such as "u_portfolio" to label each row in our dataframe. Given a significant class imbalance (with "Global Support Services" representing nearly 65% of all records) and over 2,000 missing values, we aim to eliminate categories with fewer than 100 tickets to reduce noise and concentrate on relevant classifications. We will create a consolidated text column named "text" by merging "short_description" and "description". Visualizing the updated dataframe is essential!

import matplotlib.pyplot as plt

import seaborn as sns

# Eliminate categories with fewer than 100 tickets

classifier = "u_portfolio"

ticket_threshold = 100

df_classifiers = df[df.groupby(classifier).transform(len) > ticket_threshold]

# Print number of relevant categories & shape

print("Categories: " + str(df_classifiers[classifier].nunique()))

# Plot the classifiers

fig = plt.figure(figsize=(10, 6))

sns.barplot(df_classifiers[classifier].value_counts().index, df_classifiers[classifier].value_counts())

plt.xticks(rotation=20)

plt.show()

After setting the threshold to 100 tickets, we have eliminated over five categories that lacked sufficient business value. Upon reviewing the data, I confirmed that the removed categories had not been utilized in over a year and could be safely disregarded.

It's worth noting the class imbalance in enterprise consulting: Global Support Services (GSS) accounts for more than 60% of all support tickets. This means we could create a simple program to assign GSS to every incoming ticket and still be correct over half the time!

The remaining categories will serve as labels for training and testing the model. Let's save them as a list:

category_labels = list(df_classifiers[classifier].value_counts().index)

Now that we have our category labels, we need to analyze text patterns for each ticket type. By examining the ServiceNow platform, I quickly identified several themes by category: GSS typically handles password resets and hardware issues, Business Intelligence focuses on reporting and data inquiries, Customer deals with SalesForce and other customer-related applications, and SAP S/4 Security manages all ERP-related access and configuration. If you're familiar with this corporate environment, these patterns likely resonate with you.

However, the most frequently occurring words showed minimal differences across categories. I discovered that over 75% of ticket submissions came through email, and all internal employees included a confidentiality notice in their signatures, obscuring significant differences between categories. We could experiment with adjusting the parameters to uncover other patterns or hard-code the email signature into a STOPLIST variable, but this would not address the fundamental issue. Instead, we aim to identify words and phrases that correlate with each label in our category list—a process known as Term Selection.

Let's delve into some machine learning solutions for assessing and evaluating correlation!

Chapter 1.3: Model Development

Natural Language Processing (NLP) lies at the intersection of computer science and linguistics, defining how machines and human languages can interact. Essentially, NLP processes human language by analyzing and manipulating data (often in text form) to extract meaning. To achieve this, we convert data shared between humans into a numeric format that's machine-readable. This process, known as Vectorization, enables computational operations like applying mathematical rules and performing matrix calculations that yield valuable insights.

While there are exciting emerging methods for vectorizing text data for NLP, such as Transfer Learning and advanced Neural Networks, we will utilize a more straightforward technique called Term Frequency—Inverse Document Frequency (TF-IDF). TF-IDF values increase in proportion to how often a word or phrase (n-gram) appears in a document, adjusted for the total number of documents. Although it may sound complex, it effectively highlights the importance of an n-gram to a document without favoring frequently occurring words, making it especially useful for processing imbalanced text datasets like ours.

Now that we grasp how computers process text data, we can explore different models! Below is some starter code to experiment with several options:

We will use Logistic Regression as our model of choice. As a data scientist, it's essential to apply various techniques to a project and select the one best suited to the task. In my experience, human psychology significantly influences the success of a use case; guiding an organization to embrace emerging, disruptive technologies requires time and effort! Marketing, branding, and effectively communicating your solution are just as crucial as developing an elegant algorithm. Let's build our model!

For this project, I had numerous opportunities to discuss concepts methodically and address questions in real time. A significant aspect of my success criteria was ensuring leadership understood and disseminated these data science concepts in context. Given that many other algorithms/models could enhance performance based on the data, I encourage you to experiment!

Chapter 2: Production Deployment

When a user submits a ticket, it's straightforward to extract the text and run it through the model, allowing us to determine:

  1. if the model identifies the text as relevant
  2. which category best corresponds to the text

# Save the model to variable 'model'

model = pipe.fit(X_train, y_train)

# Save array of predictions for given TEXT

predict_category = model.predict(TEXT)

# Save array of prediction probabilities for given TEXT

predict_probability = model.predict_proba(TEXT)

Both prediction variables return arrays of numbers that correspond to the length of the category list. If we examine predict_category, we should expect an array of 8 numbers, representing our 8 categories with either 0 or 1 indicating relevance. For example, if the text string is "I need a new corporate laptop," we would anticipate an array of 0's, except for a 1 in the position corresponding to "Global Support Services." The predict_probability variable will reveal how confident the model is about the prediction for GSS in context; at 98% for this specific text, we can trust the model's accuracy.

Using the same Table API we utilized to scrape the data, we can replace our GET response with a PUT request to update the ticket in ServiceNow. In real-time, when a user submits a ticket, the model can update ServiceNow with the predicted category within a minute. Let's take a moment to celebrate our successful implementation of an effective machine learning solution!

The technology stack used for deploying a model in production varies across organizations. My client primarily uses AWS and has access to the full suite of AWS tools. I experimented with Lambda and SageMaker to automate support ticket assignments in a serverless AWS environment. However, it proved easier to set up an EC2 instance to host the model and interact with ServiceNow directly. ServiceNow features built-in 'Business Rules' that can trigger API calls on the model to perform updates. The final deployment was not only cost-effective but also easier to maintain on the EC2 server, relying on effective communication between AWS and ServiceNow. I highly recommend consulting AWS documentation for comprehensive guidance.

If you're unfamiliar with these concepts, don't worry! Essentially, the machine learning pipeline should be hosted in a manner that is independent of the individuals and technologies involved. If new developers join, ticket volume surges, or leadership opts to switch from KNN in R to Logistic Regression in Python, the system must accommodate these changes. The entire pipeline was originally developed on my local machine, but for production deployment, it cannot rely on my personal computing resources or availability in the long term. Hosting it on a server (in the cloud) ensures sustainability and efficiency. This distinction between the build phase and actual deployment is crucial.

Chapter 3: Model Evaluation and Results

After all our efforts, what have we achieved? We now have an impressive ML solution that employs Natural Language Processing to categorize all incident tickets for a global organization. By automating ticket assignment and bypassing the third-party vendor, we save the enterprise nearly $600,000 annually. We improved average accuracy from 40% to 85% and halved SLA response times! Anecdotal evidence suggests a significantly enhanced user experience, leading to increased trust in the ITSM environment.

Unexpectedly, my concentrated focus on data and process enhancements within ServiceNow contributed to aligning departmental strategies and facilitating better decision-making. IT Leadership, consisting of VPs, Directors, and Senior Managers, expressed enthusiasm about saving costs, improving response times, and enhancing user experiences. Despite initial concerns about sustaining new technology and operationalizing the model in production, leadership ultimately embraced the change. The deployment provided an opportunity to democratize decision-making and promote understanding of complex data topics. I believe leadership is now better equipped to strategize and manage data science projects in the future, using this use case as a foundation to demonstrate the potential of predictive analytics.

If you have any questions or feedback regarding the methods discussed in this article, please feel free to reach out or leave a comment below! I'd love to hear from you. 😄

In this video, Susan Li explores Machine Learning applications for classifying IT support tickets, providing a valuable resource for understanding the methodology presented in this article.

This video delves into deep data insights and predictive modeling for service desk ticket data, further illuminating the concepts covered throughout this guide.

Share the page:

Twitter Facebook Reddit LinkIn

-----------------------

Recent Post:

Unlocking the Secrets of Big Data: The 5 V's Explained

Discover the essential elements of Big Data, known as the 5 V's: Volume, Velocity, Variety, Veracity, and Value, and their significance in today’s world.

Choosing Your Path: The Adventure Begins

Explore the importance of decision-making and how choices shape our lives.

Impact of Global Warming on Hibernating Mammals: Four Key Effects

Explore how climate change influences hibernation patterns in mammals, affecting their survival, reproduction, and overall well-being.

Why Spiritual Growth Is Overlooked Despite Its Life-Changing Power

Exploring why many dismiss spirituality, despite its potential to transform lives.

Discovering the Flow State: Embrace the Journey to Enjoyment

Explore how to cherish the present and enter the flow state while pursuing personal growth and fulfillment.

# Comparing Google Gemini and Bing's GPT-4 through AMC 12 Problems

A detailed analysis of Google Gemini and Bing's GPT-4 performance on the AMC 12 math problems.

Unlocking the Secrets of Emotional Intelligence: A Guide to Empathy

Explore the traits of emotionally intelligent individuals and learn how to enhance your emotional intelligence for better relationships.

Transforming Perspectives: How One Book Shifted My Outlook

Discover how one transformative book reshaped my view of life and the power of the subconscious mind.