# 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
If \$D = 'about' Then
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, '|')
If \$Call = 'About' Then
\$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 & '-')
\$Answer = "I dont remember anything about " & \$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!

Spoiler

##### 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
If \$D = 'about' Then
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, '|')
If \$Call = 'About' Then
\$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 & '-')
\$Answer = "I dont remember anything about " & \$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

Please stick to one thread per topic.

"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:

Please stick to one thread per topic.

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

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

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

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 !

Not much of a signature, but working on it...

Spoiler

##### Share on other sites
Posted (edited)

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

• ### Similar Content

• Hey there!

I've been developing a artificial intelligence.

My first hard task was letting the A.I know when a sentence is found in memory with different words
What i tried to do here is simply, get all the words in user sentence that could be used
as a identifier

example: Steve Jobs

then identify the sentence purpose with the words we found in the past "for" loop

example: Do/Know/You/Who/Steve/Jobs

Compare the example in the following matching sentences in memory.

1-Steve jobs was a known person
2-Do you know who barack obama is?
3-Do you know Steve jobs?
4-Do you know who steve jobs is?
5-How much money steve jobs had

Then find the sentence that has way more matches than the other ones, remember that if the identifier words were not found
(Steve jobs) then the sentence is invalid.

Every sentence has a different answer and is important that the right one is chosen.

If there's no more than the half of words in matches, then assign a variable the result of function, such as a return but for a global var.
I couldn't figure out how to do that with StringRegExp.

I honestly need help with detecting identifiers on memory sentences.
I would also like to let the AI know typos, meaning that moeny and money means the same thing.
Any help is hugely appreciated.

• Hey there!

I was studying about algorithms of machine learning and artificial intelligence inner systems, in specific, i would like to create a similar system like AIML and A.L.I.C.E., but in AU3.

I can re-create pretty much all the functions in AIML by myself, except for "any (*)", which is really useful for pattern detection.

Example:

How i could re-create it in Au3?

Any help is really appreciated!

• Hey There!

So, what i need to do is an app that can read text in a image (I.e. a png that has text saying "This is a png" and return the text to a variable)
I'm pretty much a newbie on AutoIt, my purpose is doing that but i don't know any function that can

Any help is much appreciated
• By kjsisco
This algorithm is loosely based on the Approximate Counting algorithm.  After the user is prompted for a starting number, a "virtual coin flip" is performed.  The numbers are then put in order from least to greatest.  This is great for sorting.

SmartCounting.au3
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...