DEV Community

rodrigohfnogueiraOBatman
rodrigohfnogueiraOBatman

Posted on

Let's talk about A.I.

#ai

Human brain

Before talking about real A.I. we need to try to understand what our brain does when making a decision. Let's imagine I have three cups, two cups made of glass and one made of plastic. I have one kid in the house, of course, I'll leave the plastic cup for childrens, in my memory I know that the cup in the children's hand has a bigger chance to fall on the floor.

Subconsciously I remember all the times a cup fell on the floor, and noticed a pattern. In my experience (for example), 80% of the times a cup has broken, it was on the hands of a children, and 60% of the times a plastic cup fell on the floor it didn't broke. So I found two facts, based on memories, that can help solve a problem.

So, we need to:

-Identify the entities of my problem.
-Identify the problem.
-Identify patterns coorelating the problem's entity and the result of my problem.
-Remember the possibilities of the patterns.
-Identify patterns that deny the effects of my problem.
-Use this pattern knowledge to solve future problems.

This is one simple kind of problem, the problem could be resolved by any different ways, proportional logic, trees, and other kind of organization our brain choose.

A.I.

Let's work the ideia inside the computer science field, using object-oriented programing.

We can first identify our entities to the problem:

-Cup
-Person

And then the problem happens when

-Cup.situation = broken;

And we know that a "Person" can be:

-Children
-Teeneger
-GrownUp

And we know that in our memory we have an inference motor wich will coorelate the facts, the rules and produce new memories with the learning. So, we know that after the lunch the inference motor will coorelate the final state of the cup and the person type to produce a memory (a fact). Let's understand a children has broke a cup, the fact will be "children - cup - broken".

After a number of lunchs we will have a combination of memories, like:

-"children - cup - broken"
-"Teeneger - cup - ok"
-"Teeneger - cup - broken"
-"GrownUp - cup - ok"
-"GrownUp - cup - ok"
-"children - cup - broken"
-"children - cup - ok"
-"children - cup - broken"
-"GrownUp - cup - ok"

So when I have to know for wich user will I give the thoughest cup, I just have to find all the percentage of broken devolutions of cups and choose the type of user wich has the biggest... In out example:

-Children {
count: 4,
broken: 3,
ok: 1,
brokenPercentage: 75%
};
-GrownUp {
count: 3,
broken: 0,
ok: 3,
brokenPercentage: 0
};
-Teeneger {
count: 2,
broken: 1,
ok: 1,
brokenPercentage: 50%
};

So the biggest chance to break a cup is to give it to a children.

Components

There are 3 main components, we have the rules, the inference motor, and the memory (facts).

The inference motor matches the rules that can be executed based on the facts avaible on the memory and process new memories.

So the components are:

-Inference Motor
-Facts
-Rules

The rules has the expert system conditions, it's where the expertise of your analysis is present.

Big Data

A basic introduction to big data is necessary in this posts because just as we can't remember everything in our life, the computer does not need to process everything to get to the correct answer in decisions.

Usually it's done using a percentage of the real memory size, we have, for example 10.000.000 registers. So we can just generate a random identifier in each register, and then just find, using statistics, a size of sample wich can give us the better margin of success with less computer processing and time.

When we select the sample to analyse we must order by the random identifier and take the firsts results, this way we can use a random sample to get the conclusion. If the statistic model has been done right, we will get the same result as if we processed all the registers in the database.

This is a simple and pratical exemple of big data's use for the AI.

Trees, Graphs and Neural Networks

There is a lot to talk about this topics so I will make one to each one of those, but for us in this posts is to understand how it can be used in de decision making process.

Another kind of decision is using graphs, where all the possibilities are considered using graphs and the decision is made using the DFS or BFS and others.

The trees are a lot similar to the graphs decisions, but more limited, it can be combined with linear algebra to get into the decision faster, it will be explain in another post.

Neural Networks had it's researchs stopped for something like 10 years, until the back propagation algorithm was developed, it has a lot of experience in the game learning, and the success point is the most important in the algorithms. It basically has neurons wich receive an input and execute a math formula to get the output, the math formula is influenced by the correction weight wich in each case of failure it auto corrects until gets success on the output. Knowing that, we have to understand there is input layers, hidden layers and output layers, and the backpropagation algorithm gives a way to send feedback with corrections in the formulas of the previous neurons.

Neural Network is a complex subject and will have a post just for it.

For now, that's enough to a "introduction" to AI.

Top comments (0)