Generic logic/conditional class or library for classification of data

Michael Bentley michael at jedimindworks.com
Sun Apr 1 08:20:20 EDT 2007


On Mar 31, 2007, at 11:54 PM, Basilisk96 wrote:

> This topic is difficult to describe in one subject sentence...
>
> Has anyone come across the application of the simple statement "if
> (object1's attributes meet some conditions) then (set object2's
> attributes to certain outcomes)", where "object1" and "object2" are
> generic objects, and the "conditions" and "outcomes" are dynamic run-
> time inputs? Typically, logic code for any application out there is
> hard-coded. I have been working with Python for a year, and its
> flexibility is nothing short of amazing. Wouldn't it be possible to
> have a class or library that can do this sort of dynamic logic?
>
> The main application of such code would be for classification
> algorithms which, based on the attributes of a given object, can
> classify the object into a scheme. In general, conditions for
> classification can be complex, sometimes involving a collection of
> "and", "or", "not" clauses. The simplest outcome would involve simply
> setting a few attributes of the output object to given values if the
> input condition is met. So each such "if-then" clause can be viewed as
> a rule that is custom-defined at runtime.
>
> As a very basic example, consider a set of uncategorized objects that
> have text descriptions associated with them. The objects are some type
> of tangible product, e.g., books. So the input object has a
> Description attribute, and the output object (a categorized book)
> would have some attributes like Discipline, Target audience, etc.
> Let's say that one such rule is "if ( 'description' contains
> 'algebra') then ('discipline' = 'math', 'target' = 'student') ". Keep
> in mind that all these attribute names and their values are not known
> at design time.
>
> Is there one obvious way to do this in Python?
> Perhaps this is more along the lines of data mining methods?
> Is there a library with this sort of functionality out there already?
>
> Any help will be appreciated.

You may be interested in http://divmod.org/trac/wiki/DivmodReverend  
-- it is a general purpose Bayesian classifier written in python.

hope this helps,
Michael



More information about the Python-list mailing list