eldr.ai | Natural Language Processing
If you haven't already, please have a look at the
Quick Start
guide before going through this tutorial as this guide is an extension of that.
ELDR AI is capable of Natural Language Processing (NLP) - it is able to extract meaning from words and sentences so you can use language in all your
predictions, insights and decision intelligence operations.
There are 3 ways of using language and NLP in ELDR AI - as an input, as an output, or both.
Using NLP on the Input side
Let's start with using NLP as an input. We'll use ELDR AI NLP to spot some Fake Reviews.
(1) Download and have a look at the NLP example
Click here to download a small CSV file (1Kb, 26 rows)
containing Review data that we want ELDR AI to learn from.
You will see we have 3 inputs - age/ip, country/ipc and the important one for this demo is review/s.
In ELDR AI on the input side we use the letter s (sentence) in the Labels row
to use words, sentences, paragraphs etc for use in AI.
Our Output in this instance is a single binary output where we are training ELDR AI to determine if the review is real or fake.
As with all inputs (ip,ipc) into ELDR AI, you can have as many sentences (s) inputs as you like, in any order and in any combination.
(2) Create ELDR AI Data
As with all the other examples, go to the Create Data page and upload the file you have just downloaded - call it "NLP".
(3) Create ELDR AI Model
You should be OK to use the default settings creating a Model here - we're asking quite a lot of this learning process using words.
(4) Train ELDR AI Model
As in previous examples, click the training icon from the View Models page.
(5) Gain Insights
ELDR AI Insights when using Sentences/Words/NLP are fascinating. They will tell you all the interactions, influences and importance of all words
in relation to the output (in this case - how each word or input contributes to the review being predicted as real or fake.)
Let's have a look at a few of the insights:
And some of the similarities of words:
(6) Get some Predictions
Here we are using ELDR AI's Chart functionality to predict that this particular review is fake.
Using NLP on the Output side
Above we were able to use NLP, words, sentences, paragraphs etc on the input side to predict an outcome.
ELDR AI can also use NLP on the output side - e.g. to predict what words will be produced in what order (a sentence) after it has
learnt the inputs. To explain this better let's delve into an example.
We're going to use ELDR AI to predict the review from above that someone might write.
(1) Download and have a look at the NLP Output example
Click here to download a small CSV file (1Kb, 10 rows)
containing Questionnaire data that we want ELDR AI to learn from.
You will notice a key difference here. The review itself is now an Output/op.
To make this AI-friendly, we need to carry out an additional step which is to encode the Output so that AI can process each of the output words. This
will become clear in the next steps.
(2) Convert the NLP output to AI friendly format
Navigate to Multi-Output Converter (ranked) and upload the CSV file you have just downloaded.
Convert that then click the blue Download button to see and download the converted file - save it.
It should look something like this.
You can see how ELDR AI has given a rank to each occurrence of a word provided to it in the output sentence/review. This means ELDR AI can learn
the order of words in an output and link it to the input.
(3) Create Data
As before use ELDR AI to Create Data using this converted CSV file.
(4) Create a Softmax Model
The reason for the red warning label at this step is we're going to do something a bit different when creating this AI Model.
We're using ranked data; not simply binary, 0s and 1s and not a single target number.
To get ELDR AI to use ranked output data, we need to use something called Softmax.
Softmax ensures that all values it
sees total 1, so gives weight accordingly to each output value - e.g. if we had outputs of 2,3,5 -> Softmax would convert them to 0.2, 0.3. 0.5.
This is really useful if you have tens, hundreds or thousands of ranked outputs.
It's easy to use Softmax in ELDR AI:
When creating your Model, use these settings in the Activation and Loss sections:
(5) Train the Model
As in previous examples, click the training icon from the View Models page.
(6) Gain Insights
Looking at AI insights when using NLP as an output is useful as it shows how each of your inputs influences each word within the NLP output.
Let's have a look at the insights and recommendations generated from our NLP Output model:
(7) Get some Predictions
Here we are using ELDR AI's Form functionality to predict the order of words after NLP is applied. Let's keep in mind that
we have only trained ELDR on 10 rows of data, with minimal inputs - in the real world this would be 1000s.
Using NLP on both Input and Output sides of an Artificial Neural Network
Above we have seen how ELDR AI can process words, sentences, paragraphs and text using Natural Language Processing independently on the input and output sides of
an Artificial Neural Network.
Let's take it one step further and use NLP on both sides of an ANN - this means we can link and predict Questions/Inputs to Answers/Outputs -
a Chat Bot in simplistic terms - but a powerful Natural Language Processing tool in may other scenarios.
Here, we are training ELDR AI to link input sentences with output sentences.
(1) Download and have a look at the NLP Input/Output example
Click here to download a small CSV file (1Kb, 5 rows)
containing NLP data that we want ELDR AI to learn from.
(2) Convert the above downloaded file to an AI friendly format
Navigate to Multi-Output Converter (ranked) and upload the CSV file you have just downloaded.
Convert that then click the blue Download button to see and download the converted file - save it.
It should look something like this.
(3) Create Data
As before use ELDR AI to Create Data using this converted CSV file.
(4) Create a Softmax Model
As a reminder, we're using a Ranked Output here so we need to create a Softmax Model.
When creating your Model, use these settings in the Activation and Loss sections:
(5) Train the Model
As in previous examples, click the training icon from the View Models page.
(6) Get some Predictions
Let's see if ELDR AI has learnt using NLP how to respond to a question after being trained.