eldr.ai | Multiple Outputs Converter (Ranked)
If you haven't already, please have a look at the
Multiple Output Converter
tutorial before going through this section as this is an extension of that one.
In the previous section we looked at how we can use ELDR to easily create AI-ready data where we have multiple output options. In that case
the options were either on/off, selected/unselected, 1/0, all or nothing etc. which is fine for a lot of AI cases e.g. predicting what state something is in,
classifying something into a distinct group, predicting the next step of a process or determining a specific diagnosis etc.
However, what if our outputs aren't always as black and white as that? E.g. what if we have a range of outputs per given set of inputs that something could fall
into where there is a known order, or rank, to the output?
The key word here is known. If we don't know the rank or order, then there is no point training AI using ranking, and binary should be used
instead.
Where ranked outputs are particularly useful is in Natural Language Processing (NLP) - where sentences are the output - because we know the rank or order of words
in a sentence, we can train AI to link inputs with sentences.
Consider that we have an input as "How are you today?". The outputs could be "I'm very well thanks" or "Not too bad today cheers" etc. For these outputs
to be useful to us, AI not only needs to learn the output words themselves, but also the order or rank they appear.
E.g. if used the normal output converter above for "i'm very well thanks" we would simply have i'm = 1, very = 1, well = 1, and thanks = 1 which
is simply telling us that these words are there. What AI actually needs to know is im = 4, very = 3, well = 2, and thanks = 1 e.g. the order, or rank.
(1) Download and have a look at the Customer Data Multi Output example
Click here to download a
small CSV file (1Kb, 50 rows) containing some basic conversation data that we want to convert to a ranked output file so ELDR AI can learn from it.
You will see we have some basic input data which should be structured in a familiar way by now - with some inputs of age (ip), county (ipc) and a question (s).
What's different here to anything we've done so far is that the output (answer) is a string of words separated by spaces - in the correct order or rank we
expect to see them in.
For this to be used in eldr AI we need to convert the file.
(2) Convert the output sentence column to multiple ranked outputs
From the sidebar or navbar menus (AI Data section) navigate to the Multi-Output Converter (Ranked) screen:
Choose your Data Type - in this case CSV - and upload the CSV file you have just downloaded, then click the "Convert" button.
You will hopefully be greeted with a success message and a new button:
Click the download button to download the converted CSV file to your machine.
You will see the single outputs (in this case a sentence) have been converted into multiple ranked words based on the inputs.
If a word is repeated a suffix of 2,3,4 etc is added to the label to make sure ranking is maintained even when there are multiple occurrences of the same entity.
(3) Run this converted file through eldr
As before, create data using the converted file you have just downloaded. This should be familiar by now.
(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 an eldr AI Model using ranked data.
We're using ranked data; not simply binary, 0s and 1s and not a single target numbers so we need to tell eldr to train its artificial neural network differently.
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 ranks
(or order of words 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:
You can now train your model as usual.
That concludes the ELDR AI guide to converting Multi Output Options (Ranked)