eldr.ai | Working with Numeric-only Data - Regression



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.

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.

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.

As with all the other examples, go to the Create Data page and upload the file you have just downloaded - call it "Regression":

ELDR AI Create Regression Data ELDR AI Create Regression Data Success

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.

ELDR AI Create Regression Model One

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).

ELDR AI Create Regression Model Two

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.

ELDR AI Create Regression Model Three

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:

ELDR AI Create Regression Model Success

As in previous examples, click the training icon from the View Models page.

ELDR AI Regression Model List

...and start training by clicking "Train Model" on the Training Page

ELDR AI Regression Train Model ELDR AI Regression Train Charts

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:

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:

ELDR AI Regression Prediction

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).

Finally let's have a quick look at ELDR AI Insights to see how each input value behaves with respect to the output.

ELDR AI Regression Insights

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).