Small Basic Forum
Small Basic AI Championship - Printable Version

+- Small Basic Forum (https://litdev.uk/mybb)
+-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1)
+--- Forum: Discussion (https://litdev.uk/mybb/forumdisplay.php?fid=4)
+--- Thread: Small Basic AI Championship (/showthread.php?tid=9)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


RE: Small Basic AI Championship - litdev - 07-13-2024

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


RE: Small Basic AI Championship - z-s - 07-14-2024

Frankly speaking I have no knowledge about ANN.
I will try it today.


RE: Small Basic AI Championship - AbsoluteBeginner - 07-14-2024

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


RE: Small Basic AI Championship - litdev - 07-14-2024

I had a go at the HSL to RGB training and will share once you have had a chance to look at it.


RE: Small Basic AI Championship - AbsoluteBeginner - 07-14-2024

(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


RE: Small Basic AI Championship - z-s - 07-15-2024

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/small-basic-blog/small-basic-artificial-neuron/ba-p/337999

https://techcommunity.microsoft.com/t5/small-basic-blog/neural-network-extension-small-basic-featured-thread/ba-p/336951

https://web.archive.org/web/20200829134255/https://social.msdn.microsoft.com/Forums/en-US/6bd8075b-691e-4761-ad33-0ba8c2635d15/neural-network-extension?forum=smallbasic

https://web.archive.org/web/20161106154921/https://social.msdn.microsoft.com/Forums/en-US/b9ab0f8c-469e-41f5-85d4-f6bd070cdefc/challenge-of-the-month-december-2015


RE: Small Basic AI Championship - litdev - 07-17-2024

Not the lightest document to read, but relevant...

https://towardsdatascience.com/how-to-teach-an-ai-to-play-games-deep-reinforcement-learning-28f9b920440a


RE: Small Basic AI Championship - AbsoluteBeginner - 07-18-2024

(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?..


RE: Small Basic AI Championship - litdev - 07-18-2024

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)



RE: Small Basic AI Championship - AbsoluteBeginner - 07-18-2024

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