Question

Looking at categorical data python implementation to create rule based engines example in python

Looking at categorical data python implementation to create rule based engines example in python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:-

Rather than re-inventing the wheel, I'd suggest you to use some readily available solution. There are several expert systems out there and I'll focus on those which are either in Python or can be used via Python.

CLIPS

CLIPS is an expert system originally developed by NASA. It's considered state of the art and used in university courses when teaching basics of AI. It's a great starting point due to its excellent documentation.

Its syntax is definitely not Python, it rather reminds of Lisp. The advantage of CLIPS is that is a solid C engine which can be fully integrated with any other Python system via its bindings: the older pyclipsand the newer clipspy. The bindings allow to embed Python code within the CLIPS language making it very easy to extend.

Rules can be loaded at runtime without the need of restarting the engine which should better suit your need.

PyKE

The Python Knowledge Engine it's a fairly powerful logic programming framework. As for CLIPS, PyKE comes with its own syntax to express rules and relies on Python for implementing the mechanics.

In other words, you write what to do in Python and you express when and how via rules.

Rules can be activated and deactivated on demand. This should allow you to support releaseless updates.

Durable Rules

Durable Rules is a fairly new project with the ambition of supporting multiple programming languages (Python, Node.js and Ruby so far).

Durable Rules allow you to write the whole knowledge base (facts and rules) in Python. The syntax might look a bit weird though, a note in this regards at the end of the post.

I am not sure if you can update the rule-set while the system is online.

Apart from the multiple syntax support, what interest me of this project is the fact the core is a C based implementation of RETE built on top of Redis DB. On a long run, this might lead to some interesting development.

PyKnow, Python Intellect & Business Rules

PyKnow

Intellect

Business Rules

These projects allow to express knowledge bases mostly in Python. I have never seen them in action and I am not sure about their performance and feature support.

The main reason I recommend against brewing your own rule engine to use in production is that, despite it seems an easy task at first, it quickly becomes evident that the problem domain is way bigger than predicted.

Python OOP nature seems initially a good fit for expressing knowledge as both Rules and Facts could be simple classes. Nevertheless, as soon as the pattern matching becomes a little more complex (Employee must have worked > 3 years in Company which Stock value is < 10$ in the last 3 years) two things become evident.

  1. The limitation of simply using and, or, not, is, ... make things really hard to read
  2. The problem suddenly reveals its exponential nature and performance become a major concern

Moreover, forcing the employees of an organization to use yet-another-in-house-built-language is usually a bad idea. It prevents them from learning something used in broader contexts such as CLIPS or Drools and will get you stuck in a maintenance/documentation loop for a long time.

Add a comment
Know the answer?
Add Answer to:
Looking at categorical data python implementation to create rule based engines example in python
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (In Python) Create an example for a generation expression that will compute the cute of all...

    (In Python) Create an example for a generation expression that will compute the cute of all of the odd numbers between 1 and 100, show how you would use this generator.

  • want to create a prefix tree in python (3) 2 ADTs Node and PrefixTree Looking to...

    want to create a prefix tree in python (3) 2 ADTs Node and PrefixTree Looking to create Node class with : -__contains__(letter) - returns true if the Node has a child corresponding to the letter -__getitem__(let) - returns the child node corresponding to the letter -add_sub(tok, value) - adds a child to the node under the given token, also handle the case if a child already exists (it should only change the value of the child) -remove_sub(let) - removes the...

  • Hi team, can you create a python programs for 1. Create DataFrame shape of 300x5 from...

    Hi team, can you create a python programs for 1. Create DataFrame shape of 300x5 from scratch a. Column_1: Generate random 300 floating numbers between 1 and 0 b. Column_2: Generate random 300 integers between 10 and 1000 c. Column_3: multiply column_2 with column_1 d. Column_4: Generate random 300 Ordinal categorical variable with three unique values e. Column_5: Generate random 300 Nominal categorical variable with two unique values 2. Get head, tail of the created data 3. Show mean, max,...

  • Subject : Visualizing Data in Python with Matplotlib Topic : Exploring Data Visually with Matplotlib using...

    Subject : Visualizing Data in Python with Matplotlib Topic : Exploring Data Visually with Matplotlib using Dictionaries Begin by reviewing the matplotlib documentation and the User Guide. Here we will make a histogram using some data from the Loan Stats Q1 2019 file. (Loan Stats Q1 2019 Download File Link : - https://www.lendingclub.com/info/download-data.action) Explore the user guide and then review this example : ( https://matplotlib.org/gallery/lines_bars_and_markers/categorical_variables.html) Question: Submit code demonstrating the following: Using the Loan Stats file, construct a dictionary containing...

  • Create a Categorical Frequency Table and Grouped Frequency Distribution table in Excel using the above data...

    Create a Categorical Frequency Table and Grouped Frequency Distribution table in Excel using the above data Example 2-1 Distribution of Blood Types Twenty-five army inductees were given a blood test to determine their blood type. The data set i:s ВВАВ B AO О O A AB B Construct a frequency distribution for the data Categorical Frequency Table (Qualitative or Discrete Data) 1. In an open workbook select cell A1 and type in all the blood types from Example 2-1 down...

  • In the range C4:C37, create a data validation rule that accepts only LIST values from the...

    In the range C4:C37, create a data validation rule that accepts only LIST values from the range I4:I7In the range C4:C37, create a data validation rule that accepts only LIST values from the range I4:I7 I highlighted cells C4:C37. Went to DATA, DATA VALIDATION. In SETTINGS, under ALLOW, I clicked on LIST. Then in SOURCE I put in, I4:I7. It does not work.  How do I enter I4:I7 into the SOURCE?

  • PLEASE YOU PYTHON 3 TO SOLVE! THANKS! PLEASE YOU PYTHON 3 TO SOLVE! THANKS! Example 1...

    PLEASE YOU PYTHON 3 TO SOLVE! THANKS! PLEASE YOU PYTHON 3 TO SOLVE! THANKS! Example 1 Design a class named Information that holds the following personal data: .name, age, address (this attribute has a default value of “unknown"), and phone number. . All the attributes are defined as private. • Write appropriate accessor and mutator methods. • Complete the definition of the str_ method, such that it displays each Information object's data in the following format: name: "Sarah Jones” –...

  • Example Given a classification problem with the following class conditional densities, derive a decision rule based...

    Example Given a classification problem with the following class conditional densities, derive a decision rule based on the Likelihood Ratio 2TT 2TT How would the LRT decision rule change if, say, the priors were such that

  • C++ Create an array-based implementation of a stack. Each element of the stack should store a...

    C++ Create an array-based implementation of a stack. Each element of the stack should store a string. The stack class should include 3 private member variables (maximum stack size, top of the stack index, and a pointer to the array that holds the stack elements). Public member methods should include a constructor (with an argument of stack maximum size that is used to create a dynamic array), a destructor (that deletes the dynamic array), a push method (argument is a...

  • Example: (From Categorical Data Analysis, by A. Agresti, 2002, 3rd edi.) The following table is f...

    Example: (From Categorical Data Analysis, by A. Agresti, 2002, 3rd edi.) The following table is from a report on the relationship between aspirin use and heart attack by a research group at Harvard Medical School. This was a 5 year randomized study of whether regular aspirin intake reduces mortality from cardiovascular disease. Every other day, physicians participating in the study took either one aspirin or a placebo. The study was blind-those in the study did not know whether they were...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT