# Machine Learning Algorithms & AI

## Recommended Posts

Hey there!

I was thinking about building a chatting artificial intelligence in AutoIt

I've been all the day learning about machine learning algorithms, but most of them were made for other type of areas such as marketing.

Anyone knows an algorithm for sentences and context pattern finding i can study?

I would also like to implement features like finding on memory related sentences and compare them

I.e. Hello, how are you

And split that sentence into 2 type of refferences to the answer, 'Hello' and 'How are you'

I.e. Wanna play?

I would like to let the bot understand same for "Wanna play" and "Wanna play?"

Or for "Hello bot' and "Hello"

Or memory finding message by conversation

I have made a memory array based on the conversation i had with the bot, but i couldnt figure a way to make the bot find in memory, even though is supposed to work properly

```\$ArrayTraceB = 0
\$MemoryArray = StringSplit(\$Memory, '|')
For \$D in \$SentenceKeyArray
MemoryFunction(\$D, \$ArrayTraceB, \$SentenceKeyArray)
Else
\$ArrayTraceB = \$ArrayTraceB +1
EndIf
Next```

Like on that code snap which leads to this function

```Func MemoryFunction(\$Call, \$Trace, ByRef \$KeyArray)
\$MemoryArray = StringSplit(\$Memory, '|')
\$FirstArray = 1
For \$Ref In \$MemoryArray
If \$FirstArray = 1 Then
\$FirstArray = 0
Else
\$NeuronValues = \$NeuronValues & '|' & \$Neurons[\$Ref]
EndIf
Next
\$NeuronValuesArray = StringSplit(\$NeuronValues, '|')
\$ArrayTrace = \$Trace +1
\$Topic = ''
While 1
If \$ArrayTrace >= \$KeyArray[0] Then
ExitLoop
Else
\$Topic = \$Topic & ' ' & \$KeyArray[\$ArrayTrace]
\$ArrayTrace = \$ArrayTrace +1
EndIf
Sleep(50)
WEnd
\$ArrayTrace = 0
\$bFound = False
_ArrayDisplay(\$NeuronValuesArray)
For \$i = 0 To \$NeuronValuesArray[0]         ; Test from element 0 to the last element of the array
If StringInStr(\$Topic, \$NeuronValuesArray[\$i]) Then
\$bFound = True
ExitLoop ; Unless i need to find more instances we exit this part of the code imediately
Global \$ArrayX = \$i
EndIf
Next
If \$bFound = False Then
MsgBox(0, '', '-' & \$Topic & '-')
\$WaitYesNo = True
\$BehaviorFlag = 2
Else
_ArrayDisplay(\$NeuronValuesArray)
MsgBox(0, '', \$ArrayX)
\$Answer = 'I remember a message saying "' & \$NeuronValuesArray[\$ArrayX] & '", do you want to talk about that?'
\$WaitYesNo = True
\$BehaviorFlag = 4
EndIf
EndIf
EndFunc```

It always misses the last word and adds an empty space char at start.

I would appreciate any suggestions

##### Share on other sites

Hi DynamicRookie.

I know you think this topic belongs here, and certainly on some levels it does. It is certainly an interesting topic and exercise.

But seeing as it has code and asks a related question or two, and I am guessing you want the brightest and greatest we have here to look at it, and respond, perhaps with code, then you are more likely to get that happening in the GH&S forum, so I recommend you Report it to be relocated there.

We don't get anywhere near as many attendees or viewers here in Chat, and many of us come here for a no code break.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

##### Share on other sites

21 minutes ago, TheSaint said:

Hi DynamicRookie.

I know you think this topic belongs here, and certainly on some levels it does. It is certainly an interesting topic and exercise.

But seeing as it has code and asks a related question or two, and I am guessing you want the brightest and greatest we have here to look at it, and respond, perhaps with code, then you are more likely to get that happening in the GH&S forum, so I recommend you Report it to be relocated there.

We don't get anywhere near as many attendees or viewers here in Chat, and many of us come here for a no code break.

All of this coming from our residential "Spam Bot"? How nice!

##### Share on other sites

7 minutes ago, Somerset said:

All of this coming from our residential "Spam Bot"? How nice!

Dog Darn It! I might reside, but I am not residential ... I am far more suave & sophisticated than that.

As for my Bot, it takes umbrage at the idea it has been spammed.

And yes, I was being nice, you dufous.

Now go and change your underpants before we get any more droppings slipping out.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

##### Share on other sites

14 hours ago, TheSaint said:

Hi DynamicRookie.

I know you think this topic belongs here, and certainly on some levels it does. It is certainly an interesting topic and exercise.

But seeing as it has code and asks a related question or two, and I am guessing you want the brightest and greatest we have here to look at it, and respond, perhaps with code, then you are more likely to get that happening in the GH&S forum, so I recommend you Report it to be relocated there.

We don't get anywhere near as many attendees or viewers here in Chat, and many of us come here for a no code break.

In part is more like asking for suggestions rather than for help, like a conversation about what algorithms are good for machine learning, i don't feel like posting a thread saying "what algorithms are good for this" on that forum, however i'll do it.

##### Share on other sites

Hey there!

I was thinking about building a chatting artificial intelligence in AutoIt

I've been all the day learning about machine learning algorithms, but most of them were made for other type of areas such as marketing.

Anyone knows an algorithm for sentences and context pattern finding i can study?

I would also like to implement features like finding on memory related sentences and compare them

I.e. Hello, how are you

And split that sentence into 2 type of refferences to the answer, 'Hello' and 'How are you'

I.e. Wanna play?

I would like to let the bot understand same for "Wanna play" and "Wanna play?"

Or for "Hello bot' and "Hello"

Or memory finding message by conversation

I have made a memory array based on the conversation i had with the bot, but i couldnt figure a way to make the bot find in memory, even though is supposed to work properly

```\$ArrayTraceB = 0
\$MemoryArray = StringSplit(\$Memory, '|')
For \$D in \$SentenceKeyArray
MemoryFunction(\$D, \$ArrayTraceB, \$SentenceKeyArray)
Else
\$ArrayTraceB = \$ArrayTraceB +1
EndIf
Next```

Like on that code snap which leads to this function

```Func MemoryFunction(\$Call, \$Trace, ByRef \$KeyArray)
\$MemoryArray = StringSplit(\$Memory, '|')
\$FirstArray = 1
For \$Ref In \$MemoryArray
If \$FirstArray = 1 Then
\$FirstArray = 0
Else
\$NeuronValues = \$NeuronValues & '|' & \$Neurons[\$Ref]
EndIf
Next
\$NeuronValuesArray = StringSplit(\$NeuronValues, '|')
\$ArrayTrace = \$Trace +1
\$Topic = ''
While 1
If \$ArrayTrace >= \$KeyArray[0] Then
ExitLoop
Else
\$Topic = \$Topic & ' ' & \$KeyArray[\$ArrayTrace]
\$ArrayTrace = \$ArrayTrace +1
EndIf
Sleep(50)
WEnd
\$ArrayTrace = 0
\$bFound = False
_ArrayDisplay(\$NeuronValuesArray)
For \$i = 0 To \$NeuronValuesArray[0]         ; Test from element 0 to the last element of the array
If StringInStr(\$Topic, \$NeuronValuesArray[\$i]) Then
\$bFound = True
ExitLoop ; Unless i need to find more instances we exit this part of the code imediately
Global \$ArrayX = \$i
EndIf
Next
If \$bFound = False Then
MsgBox(0, '', '-' & \$Topic & '-')
\$WaitYesNo = True
\$BehaviorFlag = 2
Else
_ArrayDisplay(\$NeuronValuesArray)
MsgBox(0, '', \$ArrayX)
\$Answer = 'I remember a message saying "' & \$NeuronValuesArray[\$ArrayX] & '", do you want to talk about that?'
\$WaitYesNo = True
\$BehaviorFlag = 4
EndIf
EndIf
EndFunc```

It always misses the last word and adds an empty space char at start.

I would appreciate any suggestions

##### Share on other sites

• Moderators

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

##### Share on other sites

3 hours ago, JLogan3o13 said:

Wow i was posting that on Gh&s but it posted it here?

Weird

EDIT: My bad, you moved it here

Edited by DynamicRookie
##### Share on other sites

• Moderators

You had one in Chat and one in GH & S, we don't allow duplicate threads. GH & S is where it should have lived from the beginning.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

##### Share on other sites

Just now, JLogan3o13 said:

You had one in Chat and one in GH & S, we don't allow duplicate threads. GH & S is where it should have lived from the beginning.

I understand

##### Share on other sites

• Moderators

Also, when you respond, please just hit the reply button rather than quoting everything. It pads the thread needlessly, and I know what I said (I was there when I said it).

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

##### Share on other sites

• 2 years later...

I wrote a boosted decision tree in Autoit over the weekend. Though it only supports 3 nodes & 7 Nodes, it can be coded for more nodes but I don't see any benefits in it. Autoit is kinda slow for this stuff I have to run off of 7 computers with cloud processing to building training models.

##### Share on other sites

@Dana86  Recently, someone was complaining the same thing as you.  His program was taking multiple hours to complete in AutoIt.  With his requirements, I created the same functionality and was able to run the same data in 4.5 secs.  AutoIt is not about speed or slowness , it is how strong is your algorithm.  A bad programmatic algorithm will take forever no matter is the language you are using.  If you doubt that, then show your code !

“They did not know it was impossible, so they did it” ― Mark Twain

Spoiler

##### Share on other sites

I've long identified the piece of code that uses the most CPU power but... I don't know how to optimize it... this is the best I could come up with, it made it mildly faster sometimes... I have a 6 core 4.9ghz cpu... perhaps I can write a new _ArrayFuzzyMax function & it might speed things up but ill lose some accuracy.

```Local \$Max30=_ArrayMax(\$Range,1,\$LRow-30,\$LRow,\$High)
Local \$Max60=_ArrayMax(\$Range,1,\$LRow-60,\$LRow,\$High)
Local \$Max120_0
Local \$Max120_1
Local \$Max120_2
\$Max120_2=_ArrayMax(\$Range,1,\$LRow-120-2,\$LRow-2,\$High)
If \$Range[\$LRow-1][\$High]>\$Max120_2 Then
\$Max120_1=\$Range[\$LRow-1][\$High]
Else
\$Max120_1=_ArrayMax(\$Range,1,\$LRow-120-1,\$LRow-1,\$High)
EndIf
If \$Range[\$LRow][\$High]>\$Max120_1 Then
\$Max120_0=\$Range[\$LRow][\$High]
Else
\$Max120_0=_ArrayMax(\$Range,1,\$LRow-120,\$LRow,\$High)
EndIf

Local \$Min30=_ArrayMin(\$Range,1,\$LRow-30,\$LRow,\$Low)
Local \$Min60=_ArrayMin(\$Range,1,\$LRow-60,\$LRow,\$Low)
Local \$Min120_0
Local \$Min120_1
Local \$Min120_2
\$Min120_2=_ArrayMin(\$Range,1,\$LRow-120-2,\$LRow-2,\$Low)
If \$Range[\$LRow-1][\$Low]<\$Min120_2 Then
\$Min120_1=\$Range[\$LRow-1][\$Low]
Else
\$Min120_1=_ArrayMin(\$Range,1,\$LRow-120-1,\$LRow-1,\$Low)
EndIf
If \$Range[\$LRow][\$Low]<\$Min120_1 Then
\$Min120_0=\$Range[\$LRow][\$Low]
Else
\$Min120_0=_ArrayMin(\$Range,1,\$LRow-120,\$LRow,\$Low)
EndIf```

Edited by Dana86
##### Share on other sites

On 10/5/2020 at 1:15 AM, Nine said:

@Dana86  Recently, someone was complaining the same thing as you.  His program was taking multiple hours to complete in AutoIt.  With his requirements, I created the same functionality and was able to run the same data in 4.5 secs.  AutoIt is not about speed or slowness , it is how strong is your algorithm.  A bad programmatic algorithm will take forever no matter is the language you are using.  If you doubt that, then show your code !

Any help is much appreciated!😀💖

##### Share on other sites

On 10/5/2020 at 1:15 AM, Nine said:

@Dana86  Recently, someone was complaining the same thing as you.  His program was taking multiple hours to complete in AutoIt.  With his requirements, I created the same functionality and was able to run the same data in 4.5 secs.  AutoIt is not about speed or slowness , it is how strong is your algorithm.  A bad programmatic algorithm will take forever no matter is the language you are using.  If you doubt that, then show your code !

This guy has some great insight into the problem...

## Create an account

Register a new account

• ### Similar Content

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
×
• Create New...