We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small Basic AI Championship
Hi AB,

An artificial neural net (ANN) will usually have a fixed structure for a specific task.  There will be a fixed number of inputs and another fixed number of outputs (and hidden layers).  Each input and each output will be a value normalised in some way between 0 and 1.  There will be a lot of training data (input and output) for the ANN to train with.

So, first I would do a bit of playing with the ANN to get the hang of above, like training it to do some simple tasks.  You have to be able to use the ANN a bit first, understanding its limitations - I think of it like polynommial curve fitting in more dimensions.

e.g.] Calculate H,S,L from R,G,B colours - do try this or something similar - easy to code and I expect will be quite informative about how to use ANN.

Then think hard about what your input and output variables will be for rabbit training.  Output is clearer (direction I would assume).  Input is less clear, I guess it must somehow be everything the rabbit knows about its current situation condensed into a few numbers, perhaps where it has been, how close to the wall, anything it knows about snake position....

Bear in mind that the output direction used for training should be optimal - you are training it to reproduce the output for a given input, nothing more.

Perhaps you are trying to find a set of moves that will last the longest, which I think is what your current rabbit model does.  It may be that a genetic algorithm (GA) would be more appropriate?  In this case, we try to find an optimal chromosome (list of values - could be moves).  Would need some more research (could be programmed in SB) and lots of training, each game is one evaluation and you would probably need 1000s, but it would gradually get better and better (up to a point).

In either case, the AI doesn't have much to go on in the current game to distinguish between strategies and random moves.  A GA will actually confirm this if future generations make no appreciable improvement (survival is random, not just for the fittest!).
Reply
Frankly speaking I have no knowledge about ANN.
I will try it today.
ZS
Reply
(translated by Google translator)

Hi all.  Shy
LitDev, I am very grateful to you for your participation in the discussion of the topic of neural networks.
And I will take for the test the task that you suggested.

To complete this task, I will choose the number of layers and neurons myself, using my knowledge of the neural network and of the information.
Then the most interesting moment will come: we will form our opinion about whether a random number generator can offer a more advanced neural network than mine, which I will calculate using a certain algorithm?  Rolleyes

( I want to specifically clarify that I am interested in creating a neural network using only Small BASIC and extensions that are listed in the SB-Prime Editor list )
Reply
I had a go at the HSL to RGB training and will share once you have had a chance to look at it.
Reply
(07-14-2024, 09:05 AM)litdev Wrote: I had a go at the HSL to RGB training and will share once you have had a change to look at it.

Thank you. I also want to do this myself.  Rolleyes
[-] The following 1 user Likes AbsoluteBeginner's post:
  • litdev
Reply
Hii All.
Artificial Neural Network is very interesting topic.
I study it through GPT and Google resources.
I found that it is used for Machine Learning.
I could train it and it will answer me just like a AI Robot.
I will study about it more.
Some important links from old SB FORUM.

https://techcommunity.microsoft.com/t5/s...a-p/337999

https://techcommunity.microsoft.com/t5/s...a-p/336951

https://web.archive.org/web/202008291342...smallbasic

https://web.archive.org/web/201611061549...ember-2015
ZS
[-] The following 1 user Likes z-s's post:
  • AbsoluteBeginner
Reply
Not the lightest document to read, but relevant...

https://towardsdatascience.com/how-to-te...f9b920440a
[-] The following 1 user Likes litdev's post:
  • AbsoluteBeginner
Reply
(translated by Google translator)

Hi all.  Shy
Over the past seven days, I only had the opportunity to enjoy the programming process yesterday and tonight.
I don't know how other people feel, but I get great pleasure when I manage to solve a problem that arises.
For example, tonight, I was able to get Small Basic to not sum the values of variables that it should just save to a file.
It didn’t even help me that I combined each variable with a newline character using the "Text.Append()" method.
Small Basic still continued to sum their numeric values instead of concatenating their characters into one string.

But finally I did it. And now I can start training my neural network so that it can convert RGB color to HSL.  Smile

What's new with you?..
Reply
AB,

I faced the same issue of adding numbers as strings.

Here is how I did it, making the first character a non numeric chaharacter, then removing it after adding the numeric data.  Also using brackets to make sure some number operations are performed as required.

Code:
    data = "X"
    data = data+(H/360)+LDText.LF+(S)+LDText.LF+(L)+LDText.LF+(R/255)+LDText.LF+(G/255)+LDText.LF+(B/255)
    data = Text.GetSubTextToEnd(data,2)
Reply
I only realized your life hack last night.
Until now, I thought that you were using the first "X" just to make it convenient to use the "date = date +" code inside the loop.
It turned out that in this way we achieve two goals.  Shy
Reply


Forum Jump:


Users browsing this thread: 15 Guest(s)