boolean decisions
Jared Grubb
jared.grubb at gmail.com
Tue Feb 5 15:54:34 EST 2008
Quine-McCluskey isn't too bad to do once or twice by hand, but if you change
even one row in your dataset, you'll have to repeat the ENTIRE Q-M
algorithm. It gets very tedious. For your application, I'd just use a hash
table. You dont need the reduced form of your data, you just need a look-up
table. It's a bit tedious to do by hand, but it will be much easier to
change later.... for example, if (a,b,c,d,e,f) represents the 6 parameters
as a tuple, then:
# my_decision_tree.py - a module that gives a decision based on these
data....
# Decision table encoded
datarow = {}
datarow[(0,0,0,0,0,0)] = 0
datarow[(0,0,0,0,0,1)] = 1
datarow[(0,0,0,0,1,0)] = 0
datarow[(0,0,0,0,1,1)] = 1
datarow[(0,0,0,1,0,0)] = 1
# .....
def get_decision(a,b,c,d,e,f):
# Helper-function
return datarow[(a,b,c,d,e,f)]
Or you could assign functions:
datarow[(0,0,0,0,0,0)] = function1
datarow[(0,0,0,0,0,0)] = function7
or lists
datarow[(0,0,0,0,0,1)] = [ True, False, "Andrew Jackson" ]
or whatever value you really want to return based on the input.
You could create a Python script that would generate the 64 lines so all you
have to do is manually set what each line evaluates to.... Again, this seems
easier than trying to do Q-M by hand!
Jared
On 5 Feb 2008, at 06:31, Robin Becker wrote:
Diez B. Roggisch wrote:
Robin Becker wrote:
.......
terms or something, but perhaps I am daft.
Triggered this in some deep-rootet parts of my brain stem:
http://en.wikipedia.org/wiki/Quine-McCluskey_algorithm
.....
seems like the sort of thing I can deal with though at least for this small
case.
--
Robin Becker
--
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080205/f69a2a50/attachment-0001.html>
More information about the Python-list
mailing list