amazon-web-servicesamazon-machine-learning

How to prepare Data Sets training simple calculator with AWS Machine Learning


I'm trying to build a calculator just to add two single digit numbers with AWS machine learning.

ML Data Source1: (For Training)

for(i=9;i>=0;i--)
  for(j=9;j>=0;j--)
     console.log(i + ',' + j + ',+,'  + (i+j));

Data with 0,9 all possible combinations for single digits.

ML Data Source2: (For Prediction)

for(i=9;i>=0;i--)
      for(j=9;j>=0;j--)
          console.log(i + ',' + j + ',+');

Leaving the result column empty to predict.

When I predict, Could get some of them correct, Result here. https://pastebin.com/P6qWJk5y

Thinking in a human way, Thought of repeating the same data in different order,

ML Data Source2: (For Training)

for(i=0;i<=9;i++)
      for(j=0;j<=9;j++)
         console.log(i + ',' + j + ',+,'  + (i+j));

Now tried to see if prediction an improve, there is no improvement. It is the same prediction as of first file. No changes.

Trying to use for business purpose but like to understand the predictions of how AWS machine learning works.

How to create more datasets to train the machine to yield correct results for a simple calculator?

Thanks for any pointers.


Solution

  • I was able to train AWS machine learning by adding more precision to the calculator data,

    var logbuffer = require('log-buffer');
    console.log('num,num2,op,result');
    for (i = 9.0; i >= 0;) {
        for (j = 9.0; j >= 0;) {
            console.log(i.toFixed(3) + ',' + j.toFixed(3) + ',+,' + (i + j).toFixed(3));
            j = parseFloat((j - 0.001).toFixed(3));
        }
        logbuffer.flush();
        i = parseFloat((i - 0.001).toFixed(3));
    }
    

    log-buffer is needed to prevent memory overflow.

    Apart from this I think deep learning is much better than machine learning.

    If you are looking to train similar datasets, I would recommend to move towards deep learning rather than machine learning.

    Hope it helps.