-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Decision List Learner implemented #998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thanks!
Any updates on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall it seems like a good PR, but you should wait for @norvig to respond, since it is too substantial for me to merge.
learning.py
Outdated
def DecisionListLearner(dataset): | ||
"""[Figure 18.11]""" | ||
def add(self, attr, value): | ||
"""add new attribute and value to the test""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor edit, but can you please capitalize the start of your sentences, for consistency's case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Hi,
The implementation of DecisionListLearner was incomplete (discussed in #948). I've implemented the algorithm, written tests and updated the corresponding notebook.
Here's what I've done:
DLTest class represents tests in the decision list. A
DLTest
hasattr_values
to hold attributes and corresponding values to test them against. It has some member functions like callingmatches
with an example as input checks whether the example passes the test or not, callingmatched_examples
orunmached_examples
with inputs as a list of examples returns a subset of examples which pass and don't pass the test respectively.create_DLTests creates a list of all possible
DLTest
s which are used in creating Decision List. (Decision List Learner repeatedly loops on these tests so as to find a test that agrees exactly with some subset of the training set.) It takes as inputattribute_count
which is the maximum number of attributes to consider while creating a test. As of nowattribute_count
=1 is supported.DecisionListLearner is the implementation of the of Decision list learner as mentioned in the book. Member function
decision_list_learning
is the python implementation of the pseudocodeI've added test for
DecisionListLearner
here.I've updated the learning.ipynb to include
DecisionListLearner
. I've also added an image in its description.The code is well documented, let me know if you need any clarifications regarding the code.