1. New Library-- Fuzzy Logic (long post)
- Posted by Hawke <mdeland at NWINFO.NET> Oct 01, 1998
- 503 views
- Last edited Oct 02, 1998
I'm in the very last stages of my new library. It works, I'm just finalizing the example programs now. I've finished the documentation this evening, and I'll include that here tonight, so that you can read it, and decide if you want it. An effort to determine interest, and help prevent listserv clutter. Without further ado, here is fuzzy.doc, unattached and not zipped, since many on the list cannot handle those types of files. Those that want the library will be able to get it zipped as I'll be asking Rob to put it on the main EU page. Hopefully, this library will interest a few. Take care, and care of. --Hawke' ----------------begin fuzzy.doc Fuzzy Logic Library 9-28-98 Hawke' <mdeland at nwinfo.net> <trumpyt at nwinfo.net> Version History =============== =current, public release= version 1.4 several functions were further speed optimized by prevention of recursion for the innermost dimension of sequences (which generally holds a long sequence of atoms). It duplicates a lot of code this way, but it saves many many clockticks and helps prevent cache thrashing. version 1.3 seperated:FuzzyNOT,AND & OR, and FindTruth, into three functions apiece for each of the above types of calculations. There is a generic version for each of the above, which provides extensive (but perhaps, not complete) error checking, as well as a version for truth tables that are {atom,atom} and a version for truth tables that are {seq,seq}. Neither of the last two versions mentioned perform any error checking to speak of. They are provided for the instances where you know ahead of time that all of your data and all of your truth tables are properly formatted, matched, and equal in nestings and length. This means extra speed for when you have known good data. Conversly, you can opt for a small speed penalty for data that is unknown to you (user entered?) and/or debugging needs. version 1.2 added: use of {} to bypass automatic truth table calculation in FuzzyNOT,AND, & OR version 1.1 1>many speed optimizations tried, tested, implemented. 2>discovered: minimum and maximum using "return a*(a>=b)+b*(b>a)" & viceversa bogs down in certain cases, *badly* version 1.05 added: logging to file upon error, including full logging of your *entire* dataset(s). version 1.0 first stable, properly calculating version (my head hurts now :) What is this??? =============== This is a library that will (blisteringly fast) allow you to implement 'fuzzy logic' into your software. "Great!", you exclaim, "but what does that do for me?" Simply put, you are no longer bound by 1's and 0's. You can ask questions like "Is it a little brown?" or "Is that guy skinny, slim, normal, chubby, fat or obese?" or even go crazy and compare images for use with visual recognition systems, robotic vision, and security, or compare waveforms for speech recognition perhaps. An example, easily implemented, would be: suppose you had a database of mug shots, and someone came in with a suspect photo. Using this library, you could sift through (rather quickly indeed) your entire database and determine which pictures in the database are potential matches. You cannot do this with simple "if pic_suspect=pic_database[current] then Beep()" type comparisons. Why? Because images are often slightly different in lighting and such. If one single pixel has a slightly different color/greyscale value, you won't be alerted to that possible match. Functions/Procedures/Usage ========================== You have FindTruth, FuzzyNOT, FuzzyAND, and FuzzyOR at your disposal. FuzzyNOT,AND, & OR all call FindTruth automatically so that you do not need to worry with storing intermediate results. This can be overridden by using {} for the truth table values. Why would you want to do that? For combinational logic values like a NAND. First you would find any NOT's upon your data sets and truth tables. You would then pipe the results through FuzzyAND using {} as a truth table value, that way you don't take the 0..1 ranged data and attempt to truth table it. Fuzzy.ex has more examples of this, but here is a quick one: Old={18,65} --under 18=not old, over 65=old --0..1 for 18..65 Tall={4,7} --under 4ft=not tall, over 7ft=tall --0..1 for 4ft..7ft --Who is Tall and Young? result=FuzzyNOT(AgeData,Old} result=FuzzyAND(HeightData,Tall,result,{}) Now, result has the 0..1 ranged values that answer the question. Let's look at each function more specifically now. FindTruth()