Will you be a කම්කරු, or a සෙකුරුටී? Analysis with Fuzzy Logic!
"උස නම් කම්කරු, මිටි නම් සෙකුරුටී" has been one of the trending terms among the Sri Lankans in social networks during these days. So I believe the story is not needed to be explained here. What if the minister wants to create a 'robot' to analyze those qualifications of the applicants and provide suitable jobs? That is where the concept called Fuzzy Logic comes in handy. First, let me give you a brief explanation on Fuzzy Logic.
If you are familiar with the theories behind digital electronics, the logic being used in coding, in most of the applications we are bounded with two cases; 'True' or 'False' ( 1 or 0 ). But when it comes to the reality, most often the real judgments of human are not clearly stating either true or false. (Specially girls! but except my fiance!). In fact most of those decisions lay between those 'True' and 'False' making them the two extremes. So instead of having only two cases, how can we represent this 'degree of truth' in programming? Fuzzy logic is one approach that we can try out.
In fuzzy logic, we consider two types of variables,
1. Crisp variables : which contains precise values.
ex: A = 3.532 , B = {true , false}
2. Linguistic variables : which has rather 'blurred' meanings.
ex:
Speed = {slow, normal, fast}
Salary = {high, medium, low}
ගැහැණු ළමයෙකුගේ කැමැත්ත = {කැමතියි, ටිකක් කල් යාලුවෝ වගේ ඉමු, හිතන්න කල් ඕන, අකමැතියි}
You can see that the measurement of any linguistic variable is subjective to observer or designer.
For having any mapping between a degree of membership vs membership value we define the membership function. Since these linguistic variables have 'blurred' margins, we will see overlaps among the set of membership functions.
Consider the membership function below.
You can see that there are points which can be interpreted as either of 'cold' and 'warm'. Similar story between 'warm' and 'hot'.
So what we do now is, representing the linguistic decisions we have in these kind of membership functions. We will represent the linguistic input variables and the linguistic output variable in membership functions.
Next step is to form a set of Fuzzy rules. Fuzzy rules are the conditional statements in the form of IF x is A. THEN y is B where both A and B are linguistic variables.
Ex:
(Speed = Slow) ^ (Road = Clear) => (Weather = Cold)
You will understand better with the example given at the end. Keep calm!
Once we have membership functions to inputs and output as well as the set of fuzzy rules, it is all set!
Can you guess how the process happens?
For the given input, we retrieve the degree of membership for each attribute using membership functions. (Which is known as Fuzzification). Then we apply the degrees to the fuzzy rules and receive the degree of output membership. Using that degree value finally we decide the correct linguistic output value referring to the membership functions of output (Which is known as De-fuzzyfication).
That's enough fuzzy! Now lets move into our example.
The minister is considering height, education qualifications and participation to his campaigns.
1.
2.
3.
Now let's see the membership function for the output called 'Job classification' as well.
Based on these considerations, the minister matches the occupations. We represent is logic of matching using a set of Fuzzy rules.
As per the video we saw, these are the possible rules.
1. (Height=උස) ^ (Education=ප්රමාණවත්) v (Priority=වැඩි) => (Job = ඉහල)
2. (Height=මිටි) ^ (Education=ප්රමාණවත්) ^ (Priority=අඩු) => (Job = පහල)
Based on these set of rules, you can find the relevant degree of 'Job' for your qualifications. Then using the Job classification graph, you can find the most probable job that you will get from the so called minister!
For an example:
I'm 6ft. I have a degree and I've only participated in minister's meetings. Then applying to each rule,
1. (Height=උස) ^ (Education=ප්රමාණවත්) v (Priority=වැඩි) => (Job = ඉහල)
1 ^ 1 v 0 => 1
2. (Height=මිටි) ^ (Education=ප්රමාණවත්) ^ (Priority=අඩු) => (Job = පහල)
0 ^ 1 ^ 1 => 0
Finally I got, '1' for ඉහල job and '0' for පහල job. Now referring to the job classification graph, I can say that I'm going to get a සිකුරුටි(රජයේ) or අමාත්යංශ තනතුර!
Hope you get a brief understanding on how to use Fuzzy Logic for handling linguistic variables. Learning something while having some fun is not a bad thing at all, Isn't it?
.png)







Wow! A nice article man :)
ReplyDeleteThanks a lot bro :)
DeleteImpressive... Good content ... 😊
ReplyDeleteThanks a lot Nandun :)
DeleteGreat One :)
ReplyDeleteThanks a lot Chamalee :)
Deletei was analyzing a number of your content material harshly this website and that i conceive this net web page is in reality informative ! hold whilst inspiration to setting happening. Young Thug Net Worth
ReplyDelete