Jump to content

Going Retro


Recommended Posts

  • Moderators

Looks like going retro is the way to go these days

Sony just introduced the new=old walkman, selling for some $4K

Arca Noae has developed a new full distro of IBM's OS/2

I've heard some people are even dabbling with AmigaOs ... :)

 

This reminds me of the first book I ever bought on the subject of AI :

"Build your own expert system" by Chris Naylor, printed 1983

A very entertaining publication, well written and featuring code in Apple Basic and Sinclair Spectrum (!)

At some stage I converted that to Delphi and lately to SMS, just to see how the early AI compares to todays AI

 

One of the datasources used was weatherdata for the month of March 1982, London

31 days with values for min-temp, max-temp, rainfall and sunshine

The expert system was trained on this dataset and was subsequently able to answer the question whether or not it would rain tomorrow.

It wasn't infallable though, at one testing session it made 8 mistakes out of the 31 data records

 

So I decided to run the same test on my SMS neural network (see previous posts)

      MyNetwork.AddTrainingdata ([9.4, 11.0, 17.5,  3.2] ,  [1.0, 0.0]);
      MyNetwork.AddTrainingdata ([4.2, 12.5,  4.1,  6.2] ,  [1.0, 0.0]);
      MyNetwork.AddTrainingdata ([7.6, 11.2,  7.7,  1.1] ,  [1.0, 0.0]);
      MyNetwork.AddTrainingdata ([5.7, 10.5,  1.8,  4.3] ,  [0.0, 1.0]);
...
      MyNetwork.AddTrainingdata ([6.7,  8.8,  6.4,  4.2] ,  [0.0, 1.0]);
      MyNetwork.AddTrainingdata ([4.5,  9.6,  0.0,  8.8] ,  [1.0, 0.0]);
      MyNetwork.AddTrainingdata ([4.6,  9.6,  3.2,  4.2] ,  [1.0, 0.0]);
 
      MyNetwork.LearningRate := 0.1;
      MyNetwork.TrainingSplit := 10;  //split trainingset randomly: 10% for testing, 90% training
      For var i := 1 to 1 do begin         //1 epoch
        MyNetwork.Train;
      end;
 

the input arrays (like [9.4, 11.0, 17.5,  3.2]) give the values for temp, rainfall etc for a specific day and the output arrays give either [1.0, 0.0] for rain tomorrow or [0.0, 1.0] for no rain tomorrow

This dataset was split in two, 90% or 27 randomly selected records were used for training and the remainder was used for testing

Running the neural network with this training / testing scenario proved to be no hassle, it gets it right every time

 

So I decided to up the ante a bit

In the following scenario the network is trained on a subset of only 40% for training (12 records) and 60% for testing and the prediction is how much rainfall in mm there will be the day after (0, 1, 2, 3, 4, 5, 6, 7 or more than 8 mm) - a 4 input, 9 output network

      MyNetwork.AddTrainingdata ([9.4, 11.0, 17.5,  3.2] ,  [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0]); 
      MyNetwork.AddTrainingdata ([4.2, 12.5,  4.1,  6.2] ,  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0]); 
      MyNetwork.AddTrainingdata ([7.6, 11.2,  7.7,  1.1] ,  [0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]); 
      MyNetwork.AddTrainingdata ([5.7, 10.5,  1.8,  4.3] ,  [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]); 
....
      MyNetwork.AddTrainingdata ([6.7,  8.8,  6.4,  4.2] ,  [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]); 
      MyNetwork.AddTrainingdata ([4.5,  9.6,  0.0,  8.8] ,  [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]); 
 
      MyNetwork.LearningRate := 0.1;
      MyNetwork.TrainingSplit := 60;  //split trainingset randomly: 60% for testing, 40% training
      For var i := 1 to 20 do begin       //20 epochs
        MyNetwork.Train;
      end;

The outcome blew my mind. Using only a very limited datasource of 12 weather records the system is able with no errors to provide the correct amount of rainfall in mm next day every time

 

Guess that may beat the local weather forecast

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...