Neural Network basics - Artificial Intelligence using AutoHotkey!

Helpful script writing tricks and HowTo's
User avatar
nnnik
Posts: 3201
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

05 May 2018, 01:39

Well if we really wanted to program Neural Networks in AHK we probably need to implement a framework like iseahound mentioned.
And that seems like a lot of work for a single person.
Recommends AHK Studio
blue83
Posts: 9
Joined: 11 Apr 2018, 06:38

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

15 May 2018, 01:32

Hi I have one more question.

Here are examples how can we use AI if we use some conditions to recieve something back.

Because AHK is script languague for automation of tasks in windows, my question is can be done something about prediction of our moves, clicks etc.

I mean that UI can learn how we use Windows and if something happens that we dont have in our script, that UI can learn and act accordingly to that new situation.

Also there is an issue with unstructured data.

Thanks
User avatar
Gio
Posts: 450
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

16 May 2018, 15:40

blue83 wrote:how can we use AI if we use some conditions to recieve something back.

(..) my question is can be done something about prediction of our moves, clicks etc.

I mean that UI can learn how we use Windows and if something happens that we dont have in our script, that UI can learn and act accordingly to that new situation.


In my opinion something like that is certainly possible, although it will most likely take the form of a project and scope planning must be considered. In this video a Neural Network was trained to play a certain game (Mario Kart) based on the inputs of a player related to the position of the objects on screen. The key point in there is that the network does not even know what winning a race is, but was able to win an entire cup by attempting to predict and mimic the players movements in each new situation based on previous data.

To this end, it is important to realise that the scope of the project is very important and must be very well planned. A network to predict any possible human action in a computer will certainly be too costly for any practical implementation, but a network that decides when a pop-up window is probably going to be immediately closed by the user, and than closes it for the user is something much more feasible to do. Also, it is impotant to realise that some tasks are more efficiently done by ordinary programming. Opening certain programs on boot based on how likely the user is to open that program as soon as he boots the PC is something that can be achieved with more simple statistic controls than a Neural Network. Also, prediction accuracy demands are VERY important. Neural Networks are unlikely to be 100% precise in their judgements. If an accuracy between 95-98% is too troublesome (i.e., there being a certain pop-up window that should never ever be closed, such as an online test that considers each session an attempt), i would suggest considering the project too complicated unless previous experience tells you otherwise or some form of "easy undo" routine is present (i.e, let's suppose that the flagged pop-ups are not really immediately closed, but rather hidden for some seconds before closing and the user can unhide during this time).
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
blue83
Posts: 9
Joined: 11 Apr 2018, 06:38

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

17 May 2018, 03:18

Hi Gio,

Thank you for your answer and clarification.
User avatar
Gio
Posts: 450
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

29 May 2018, 12:33

Just watched an excellent Youtube video by SciShow that deals with the hardships of developing self-driving cars. This is a perfect example on how overly complicated abstract models will still require a lot of programmers work for the years to come. I guess it is pretty safe to say this is a great opportunity :thumbup:
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
User avatar
nnnik
Posts: 3201
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

16 Jun 2018, 15:04

I worked a little on Speedmasters example grid for section 2 of your tutorial.
Here is the updated version:
-On clicking the VALIDATION CASE the resulting values will be updated automatically
-extracted the network creation and training code and put it into a class
-added a second output
-clicking calculate ANN wont reset the neurons
-added bias to each neuron

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Recommends AHK Studio
User avatar
Gio
Posts: 450
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

18 Jun 2018, 10:08

nnnik wrote:I worked a little on Speedmasters example grid for section 2 of your tutorial.
Here is the updated version:
-On clicking the VALIDATION CASE the resulting values will be updated automatically
-extracted the network creation and training code and put it into a class
-added a second output
-clicking calculate ANN wont reset the neurons
-added bias to each neuron


Excellent Nnnik, the new class style is very nice :thumbup:

Will link your version in the tutorial aswell.
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
User avatar
nnnik
Posts: 3201
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

18 Jun 2018, 11:22

There is a bug in it though.
I tried training a deeper neural network using a part of the MNIST database: (28x28 Inputs, 16 Neurons each layer, 3 hidden layers, 10 outputs )
http://yann.lecun.com/exdb/mnist/
However the performance is abyssmal. I think I might update the entire library to use a Matrix class which uses binary data storage and MCODE to do the calculations.
Additionally the splitting between the input and output inside the train method itself is unneccessary. I think I will just accept 2 parameters and possibly also allow for binary data there.
While the script was still at 0% progress after letting it for a night it was already down to 16.6% total error.

If anybody is interested:
The script expects 2 files from the mnist database in its folder (see my link above)
The training images should be called "images" with no extension.
The training labels should be called "labels" with no extension.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Recommends AHK Studio
User avatar
Gio
Posts: 450
Joined: 30 Sep 2013, 10:54
Location: Brazil

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

18 Jun 2018, 12:47

nnnik wrote:While the script was still at 0% progress after letting it for a night it was already down to 16.6% total error.


This is pretty awesome news actually. 83.4% accuracy is very exciting for a first shot. Random guessing is only 10% accurate, which means you managed to get the AHK coded network to learn a lot about the images. Regarding the processing times, it reminds me of a barcode reader i once developed. At first, it was taking like 2-3 minutes for the code to scan an image. After changing the method of retrieving the pixel colors though, it started to scan the whole images in like 3-5 seconds. Optimization can make huge speed improvements when dealing with bulk data.

Also, maybe we can use Michael Nielsens python code as a rough estimate for how long a well optimized code will take to run the Mnist Database. After running a translation of the code to Python 3.x i saw it achieve 94% accuracy in under 5 minutes. Curisously though, a second run of the same Python code only got to 83,53% accuracy after 10 minutes :crazy:

Michael probably did a lot of testing untill he got that specific code though (simplicity of code often hides the hardwork of optimizing it).

First run:
PYTHON RESULTS.png
(55.81 KiB) Not downloaded yet


Second run:
PYTHON RESULTS2.png
(34.55 KiB) Not downloaded yet


The Python version i ran the code on was 3.6.4 and the files can be downloaded here. To run the code, open the file Nielsen Code 3x by Unknown.Py inside the TEST CASE folder on Python 3.6.4 IDLE. Numpy must be installed aswell.

I think I might update the entire library to use a Matrix class which uses binary data storage and MCODE to do the calculations.
Additionally the splitting between the input and output inside the train method itself is unneccessary. I think I will just accept 2 parameters and possibly also allow for binary data there.


Those are some very good ideas :thumbup:
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
User avatar
nnnik
Posts: 3201
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Neural Network basics - Artificial Intelligence using AutoHotkey!

18 Jun 2018, 13:09

Well it's not hard to get ideas for optimisation from the current implementation - there is a lot of room for it.

I also plan to create different types of neural networks such as Convolutional neural nets and LSTM for RNN.
I might want to look into GANs but right now thats far into the future since finals are coming up and I have a lot of projects coming from my uni.
Recommends AHK Studio

Return to “Tutorials”

Who is online

Users browsing this forum: vahju and 7 guests