Jump to content

Recommended Posts

Posted (edited)

You need to train a neural net on data, using this code:

#include "_Fann.au3"

Global $InputsArray[4][2] = [[-1, -1],[-1, 1],[1, -1],[1, 1]]
Global $OutputsArray[4][1] = [[-1],[1],[1],[-1]]
Local $ANNLayers[3] = [2, 3, 1]
_InitializeANN()
$Ann = _CreateAnn(3, $ANNLayers)
_ANNSetActivationFunctionHidden($Ann, $FANN_SIGMOID_SYMMETRIC)
_ANNSetActivationFunctionOutput($Ann, $FANN_SIGMOID_SYMMETRIC)
_ANNTrainOnData($Ann, $InputsArray, $OutputsArray, 5000, 10, 0.001)
_ANNSaveToFile($Ann, "xor_float.net")
_DestroyANN($Ann)
_CloseANN()

The ANN being created has 3 layers, 2 input, 3 hidden, and 1 output neuron.

For my example, you need to create a neural network with 3 layers, 24 inputs in the first one, 12 hidden neurons, and 11 outputs. The training data is saved into .data files, the networks into .net. It looks like you tried to load the training data as a network.

I've got it .I mixed between mousepatterns.net and mousepatterns.data

Thanks!

Edited by lsakizada

Be Green Now or Never (BGNN)!

Posted (edited)

I tried to make an example that learn division but is not working, anyone a little help?

#include <_Fann.au3>

Dim $INPUT[5][2] = [[2,1],[8,4],[12,3],[5,2],[9,1.5]]
Dim $OUTPUT[5][1] = [[2],[2],[4],[2.5],[6]]
Local $LAYER[3] = [2, 3, 1]

_InitializeANN()
$ANN = _CreateAnn(3,$LAYER)
_ANNSetActivationFunctionHidden($ANN, $FANN_SIGMOID_SYMMETRIC)
_ANNSetActivationFunctionOutput($ANN, $FANN_SIGMOID_SYMMETRIC)
_ANNTrainOnData($ANN,$INPUT,$OUTPUT, 15000, 1000,0.001)
_ANNSaveToFile($ANN, "num_div.net")
_DestroyANN($ANN)
_CloseANN()

Dim $CALC[2] = [4,1]
_InitializeANN()
$ANN = _ANNCreateFromFile("num_div.net")
$RESULT = _ANNRun($ANN,$CALC)
MsgBox(0,"Division", $CALC[0] & " / " & $CALC[1] & " = " & $RESULT[0])
_DestroyANN($ANN)
_CloseANN()
Edited by Andreik
Posted

Looks interesting but every time when I run some of the scripts here it doesn't work.

C:\Program Files\AutoIt3\Include\_Fann.au3 (48) : ==> Subscript used with non-Array variable.:
Return $hAnn[0]
Return $hAnn^ ERROR
Posted

@Andreik, try different numbers of neurons and hidden layers between your inputs and outputs, it could be that the relation you're trying to model is more complex than can be represented with just 3 neurons. It will take some trial and error, but I think it can be done. Maybe try 2 hidden layers with 4 neurons each?

Local $LAYER[3] = [2, 4, 4, 1]

@Jjo, the include folder isn't for scripts that you download, that's used for core AutoIt includes. Put _Fann.au3 in the same directory as the script you're trying to use, and do #include "_Fann.au3".

The error is meaningless without knowing what script you're running, what directory the dll is in, and so on. So, let me know more information. :)

Posted

@Jjo, the include folder isn't for scripts that you download, that's used for core AutoIt includes. Put _Fann.au3 in the same directory as the script you're trying to use, and do #include "_Fann.au3".

The error is meaningless without knowing what script you're running, what directory the dll is in, and so on. So, let me know more information. :)

Ok that worked, thanks. :)
  • 1 year later...
Posted

Its stilll not working for me...I am also getting the same error as that of jijo. The udf, the dll file and the example file is in the same directory still it is not working. plz help..!! :graduated:

[font="Comic Sans MS"][size="7"]Piyush.....[/size][/font][font="Palatino Linotype"][size="2"]Some Of My Scripts...Cool Font Generator Train Searcher and Tracer[/size][/font]

  • 3 weeks later...
  • 4 weeks later...
  • 1 year later...
  • 5 years later...
Posted

First my appology for resurecting this thread. But I'm curious, and someone monitoring this thread from way back might have good answers.

1: Does anyone use FANN (with autoit) these days?

2: Does anyone use it on win64? To me it looks like a wraper to handle pointers to structs are needed between the library and AutoIt?

3: Is there any other Neural Network Library in use with AutoIt?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...