Skip to content

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

pyaf
Copy link

@pyaf pyaf commented Dec 21, 2018

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 has attr_values to hold attributes and corresponding values to test them against. It has some member functions like calling matches with an example as input checks whether the example passes the test or not, calling matched_examples or unmached_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 DLTests 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 input attribute_count which is the maximum number of attributes to consider while creating a test. As of now attribute_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 pseudocode

  • I'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.

Copy link
Contributor

@ad71 ad71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Thanks!

@pyaf
Copy link
Author

pyaf commented Mar 1, 2019

Any updates on this PR?

Copy link
Collaborator

@antmarakis antmarakis left a 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"""
Copy link
Collaborator

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants