eldr.ai | Working with Numeric-only Data - Regression
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.
Up until now we've dealt with AI Data and AI Models that contain/use various types of inputs e.g. scale values (ip) such as Age and Credit Score, along with
categorical values(ipc) such as Post Codes and Products, as well outputs (op) that are geared towards more classification (yes/no)
scenarios.
However, ELDR AI is also capable of working with purely numeric data for use in e.g. scientific analysis, finance, stock market, engineering,
problem solving and cryptography etc.
When AI is used in this way we call it regression - and we use AI Models to learn how to work
out numerical problems for themselves. Exactly like the alpha-numeric examples so far, we provide ELDR AI data (in this case numerical) to learn from
(learn the patterns and relationships between numbers) so that when we give it some new numerical data it can perform a calculation on it.
The result of the calculation is our prediction. Using ELDR AI we can work out and make sense of very complex numerical relationships.
Let's show this with a simple example - we'll get ELDR AI to learn how to add two numbers together. This might sound very easy - however, we're asking
ELDR AI to work this out for itself based on what we show it. If it can work this out, it can work anything out.
(1) Download and have a look at the Regression example
Click here to download a small CSV file (1Kb, 23 rows)
containing Regression Data that we want ELDR AI to learn from.
You will see we have 2 inputs(ip) - A & B and a single output(op) - C. It's clear for us humans to see that A + B = C, but we want ELDR AI to spot this pattern and
learn the relationship - so that when we give it 2 numbers it hasn't seen before it can tell us the correct answer.
This same approach can be used to spot patterns in any numerical data.
(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 "Regression":
(3) Create ELDR AI Model
Up until now we have used the Default ELDR AI Model values to create a Model. We're now using ELDR AI for something different so we will change some of the AI Model
Parameters. All changes will be explained.
The first change to make is to the number of layers and neurons in the Artificial Neural Network. Because we're only using a few rows of data and only
three columns of data, we don't need so many neurons. The more neurons does not always mean better learning - in fact too many neurons can be as bad as too few.
Let's have 2 layers; one with 5 neurons, the other with 3 (red box).
The second change to make is to the Epochs and Loss (green box). Because we're using purely numbers and we want our calculations to be highly accurate, we need ELDR AI to
spend longer training - 1 Epoch is 1 loop or round of training, so let's increase it to 100,000. Loss is a measure of how precise we want training to be.
The higher the Loss value in the dropdown, the more precise. (Loss during Training is actually 1/Loss). Increase Loss to 10000. Combined,
this will ensure ELDR AI spends more time training than it did in other examples.
The next change to make is to the Optimiser. Before, we have used "Adam" as our optimiser. There is debate about this, however at Fennaio we believe Adam is excellent
where Training can be relatively fast, whereas SGD is better where Training has to be relatively Accurate.
Both are very good and Adam is the best all-rounder, but for this let's use SGD (blue box).
The last change to make is to the Learning Rate. Again this influences precision and speed. When you're interested in Accuracy, it's better to have a lower learning
rate - so here let's choose 0.003 (orange box), as opposed to 0.02 from before.
Press the "Create" button and hopefully you will see the success message:
(4) Train ELDR AI Model
As in previous examples, click the training icon from the View Models page.
...and start training by clicking "Train Model" on the Training Page
As we requested and expected, this took a bit longer to train than other examples as we asked for a more precise Loss (yellow box), that we reached,
however we still only used less than 60% of our maximum Epochs and about 20% of our maximum time (green box).
OK,it looks like ELDR AI successfully trained this Model. Let's see if it worked the regression problem out:
(4) Get Predictions
As in all other examples to date, we'll use the Form on the "Ask ELDR" predictions page, and this time we'll use the Form functionality to make two predictions
at the same time: one with known values, and the other with unknown values:
It looks like ELDR AI performed OK. It was certainly able to learn the relationship between our provided data (red box pair) and when given two unknown values
it more or less worked out 2.65 + 4.35 should be 7 (green box pair) - close enough (0.04 out) for many circumstances, however there is obviously
still scope for improvement - and this can be done by many ways including (1)Improve the data size and quality (2) Change the Neural Network structure (3)
Change Model Parameters (4) Increase Training Time (5) Request more precision
Note, in this example we didn't get any recommendations on the predictions page. That's because recommendations are only provided for categorical data (ipc).
(5) Gain Insights
Finally let's have a quick look at ELDR AI Insights to see how each input value behaves with respect to the output.
Unsurprisingly, as each input (A or B) goes up, the output (C) goes up - as would be expected for this particular regression problem.
Note, in this example we don't get any similarity data on the insights page. That's because similarities are only provided for categorical data (ipc).
That concludes the ELDR AI guide to working with numerical-only data (regression).