Automated natural language analysis using perturbations
A natural language analysis system processes a data item and recommends similar data items. The natural language analysis system preprocesses the data items. The natural language analysis system encodes the text of the input data item using a machine learning model, such as a transformer model. The natural language analysis system recommends related data items based on the encodings of the data items. The natural language analysis system uses perturbations to provide explanations for the recommendations and/or improve the recommendations.
1 . A system comprising:
a data storage medium to store a plurality of data items, wherein each data item of the plurality of data items comprises text data; and
a computer hardware processor in communication with the data storage medium, wherein the computer hardware processor executes computer-executable instructions to at least:
receive, from a ticketing system, a first data item comprising first text data;
determining a first encoded vector based on the first text data using a machine learning model;
apply a nearest neighbor algorithm to the first encoded vector, wherein the nearest neighbor algorithm outputs a first set of data items from the plurality of data items;
generate perturbed text data from the first text data;
determining a second encoded vector based on the perturbed text data using the machine learning model;
apply the nearest neighbor algorithm to the second encoded vector, wherein the nearest neighbor algorithm outputs a second set of data items from the plurality of data items;
generate a perturbation metric from the first set of data items and the second set of data items;
determine an indicator based on the perturbation metric; and
cause presentation, in a graphical user interface, of the first text data, the first set of data items, and the indicator.
2 . The system of claim 1 , wherein to generate the perturbed text data, the computer hardware processor executes further computer-executable instructions to at least:
replace a word in the first text data with a mask token, wherein the perturbed text data comprises the mask token.
3 . The system of claim 1 , wherein to generate the perturbed text data, the computer hardware processor executes further computer-executable instructions to at least:
replace a word in the first text data with a synonym, wherein the perturbed text data comprises the synonym.
4 . The system of claim 1 , wherein to generate the perturbed text data, the computer hardware processor executes further computer-executable instructions to at least:
replace a first character in the first text data with a second character, wherein the perturbed text data comprises the second character.
5 . The system of claim 1 , wherein the indicator comprises a ranking of a first portion of the first text data relative to a second portion of the first text data, wherein to cause presentation of the indicator, the computer hardware processor executes further computer-executable instructions to at least:
cause presentation, in the graphical user interface, of the ranking associated with the first text data.
6 . The system of claim 1 , wherein the indicator comprises a subset of the first text data, wherein to cause presentation of the indicator, the computer hardware processor executes further computer-executable instructions to at least:
cause presentation, in the graphical user interface, of the subset of the first text data as visually distinct from a remainder of the first text data.
7 . A system comprising:
a data storage medium to store a plurality of data items, wherein each data item of the plurality of data items comprises text data; and
a computer hardware processor in communication with the data storage medium, wherein the computer hardware processor executes computer-executable instructions to at least:
receive, from a ticketing system, a first data item comprising first text data;
determine a first encoded vector based on the first text data using a first machine learning model;
apply a nearest neighbor algorithm to the first encoded vector, wherein the nearest neighbor algorithm outputs a first set of data items from the plurality of data items;
determine, from the first text data, explainable text associated with the first data item and the first set of data items; and
cause presentation, in a graphical user interface, of the first set of data items, and the explainable text.
8 . The system of claim 7 , wherein to apply the nearest neighbor algorithm to the first encoded vector, the computer hardware processor executes further computer-executable instructions to at least:
calculate a cosine distance between the first encoded vector and a third encoded vector associated with a data item from the first set of data items; and
determine that the cosine distance satisfies a threshold distance value.
9 . The system of claim 7 , wherein to determine the explainable text associated with the first data item and the first set of data items, the computer hardware processor executes additional computer-executable instructions to at least:
generate perturbed text data from the first text data;
determine a second encoded vector based on the perturbed text data using the first machine learning model;
apply the nearest neighbor algorithm to the second encoded vector, wherein the nearest neighbor algorithm outputs a second set of data items from the plurality of data items;
generate a perturbation metric based on the first set of data items and the second set of data items; and
identify, from the first text data, the explainable text based on the perturbation metric.
10 . The system of claim 9 , wherein to generate the perturbation metric, the computer hardware processor executes further computer-executable instructions to at least:
calculate a number of data items different between the first set of data items and the second set of data items, wherein the perturbation metric comprises the number of data items.
11 . The system of claim 9 , wherein to generate the perturbation metric, the computer hardware processor executes further computer-executable instructions to at least:
calculate a statistical measure indicating a change in cosine distance between the first encoded vector and encoded vectors for the first set of data items and the second set of data items, wherein the perturbation metric comprises the statistical measure.
12 . The system of claim 7 , wherein the computer hardware processor executes further computer-executable instructions to at least:
select the first machine learning model from a plurality of machine learning models.
13 . The system of claim 7 , wherein to determine the first encoded vector using the first machine learning model, the computer hardware processor executes further computer-executable instructions to at least:
extract the first encoded vector from a hidden layer of the first machine learning model.
14 . A computer-implemented method comprising:
receiving a first data item comprising first text data;
determining a first encoded vector based on the first text data using a machine learning model;
applying a nearest neighbor algorithm to the first encoded vector, wherein the nearest neighbor algorithm outputs a first set of data items;
generating perturbed text data from the first text data;
determining a second encoded vector based on the perturbed text data using the machine learning model;
applying the nearest neighbor algorithm to the second encoded vector, wherein the nearest neighbor algorithm outputs a second set of data items;
generating a perturbation metric based on the first set of data items and the second set of data items;
determining an indicator based on the perturbation metric; and
causing presentation, in a graphical user interface, of the first text data, the first set of data items, and the indicator.
15 . The computer-implemented method of claim 14 , further comprising:
determining, from a plurality of data items, a subset of data items based on a filter, wherein applying the nearest neighbor algorithm further comprises:
selecting the first set of data items from the subset of data items.
16 . The computer-implemented method of claim 15 , wherein the filter comprises a filter value, and wherein determining the subset of data items based on the filter further comprises:
identifying, from the plurality of data items, a data item comprising a field value corresponding to the filter value.
17 . The computer-implemented method of claim 14 , wherein each data item from a plurality of data items comprises a title and the first data item comprises a first title, the computer-implemented method further comprising:
generating a statistical measure from a term frequency-inverse document frequency (TF-IDF) based on words from each title in the plurality of data items;
generating a plurality of clusters of data items based on the statistical measure; and
identifying, from the plurality of clusters of data items, a first cluster of data items associated with the first title, wherein applying the nearest neighbor algorithm further comprises:
selecting the first set of data items from the first cluster of data items.
18 . The computer-implemented method of claim 14 , wherein the machine learning model comprises a bidirectional encoder representations from transformers (BERT) model.
19 . The computer-implemented method of claim 14 , wherein the machine learning model comprises a generative pre-trained transformer (GPT) model.
20 . The computer-implemented method of claim 14 , wherein the nearest neighbor algorithm comprises a ball tree nearest-neighbor algorithm.