Fuzzy Logic And Uncertainty In AI
Written by Mike James   
Friday, 20 August 2021
Article Index
Fuzzy Logic And Uncertainty In AI
Multi-valued logic
Fuzzy factors in Prolog

logic1

 

Prolog is an excellent language to implement any logic or rule based reasoning in - including when things get fuzzy. So it is worth taking a closer look at how we can include fuzzy logic in with Prologs standard logic.

Fuzzy Factors In Prolog

If you do decide that you want to include fuzzy logic or probability into Prolog programs then you don't have to worry that Prolog is based on traditional logic.

All you have to do is include a numerical value in each clause giving the clause's truth value, confidence factor or probability depending on the system that you are trying to implement.

The definition of each clause should also include a predicate that calculates the new truth value as the clause is proved.

For example, if you want to work with fuzzy logic then you might use something like:

fault(fuel_system,F):-
   is(battery,F1),is(tank_full,F2),
                            max(F,F1,F2).

where F1 is the truth value of 'is the battery OK', F2 is the truth value of 'tank full' and max sets F to the maximum of F1 and F2 so giving the truth value of 'fault=fuel_system'.

Notice that this isn't quite a full fuzzy logic reasoning system because using this method no clause would fail and so there would be no backtracking. This is because every clause is true at some fuzzy level or other. 

The first clause tested for fault would return true with a truth value that might or might not be the largest possible. To enforce backtracking you either have to set a threshold - e.g. F>0.9 at the end of each clause or you would have to use the findall predicate to return all of the possible faults with their associated truth values.

In practice a combination of both methods is necessary because without failing clauses with small truth values findall would return far too many potential solutions for normal computer to cope with.

Have confidence

What all this means is that there is no good or accepted method of dealing with uncertainty, beliefs or any sort of vagueness within rules.

Currently expert or rule based systems adopt any method that seems to give reasonable results. Most of them call their measures of certainty etc. 'confidence factors' or something other than probability. However as most confidence factors range between 0 and 1 or 0 and 100 it is difficult for an innocent user not to be tempted into thinking that they are probabilities.

At the end of a consultation an expert system may give you a conclusion with a confidence factor of 80% but whatever this means it doesn't mean that it expects to be correct 80% of the time in giving this diagnosis on the basis of the facts that have been supplied.

Confidence factors are not probabilities and the best you can do is come to some feeling that the conclusion has a high, low or medium confidence factor.

We clearly have a long way to go when it comes to building computer programs that reason like human experts.

 

logic2

 

Mike James is the founder and editor in chief of the I Programmer website. He is also a prolific author. Among his recent titles is The Programmer’s Guide To Theory which sets out to present the fundamental ideas of computer science in an informal and yet informative way

More Information

SWI Prolog

Related Articles

Database The Prolog Way

Expert Systems and Prolog

The Greeks, George Boole and Prolog

The Triumph Of Deep Learning

Robot cars - provably uncrashable?

The Paradox of Artificial Intelligence

The Genetic Algorithm

Watson wins Jeopardy! - trick or triumph

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

<ASIN:1871962439>

<ASIN:0201403757>

<ASIN:0262514451>

<ASIN:0136070477>

<ASIN:0006547133>

<ASIN:0201403757>



Last Updated ( Friday, 20 August 2021 )