Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #29 from georgianpartners/issue_27
Browse files Browse the repository at this point in the history
Changed intent priority from a distance from root node priority (brea…
  • Loading branch information
alexrallen committed Jan 14, 2019
2 parents be7d368 + a8e75d6 commit 9a4b577
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions doc/users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ Preprocessor uses a hierarchical structure defined by the superclass (parent) an
and intent. There is also a priority order defined in each intent to break ties at the same level.

This tree-like structure which has :py:obj:`GenericIntent <foreshadow.intents.GenericIntent>` as its
root node is used to prioritize Intents. Intents further down the tree more precisely define a feature, thus the Intent
farthest from the root node that matches a given feature is assigned to it.
root node is used to prioritize Intents. Intents further down the tree more precisely define a feature and intents further to the right hold a higher priority than those to the left, thus the Intent represented by the right-most node of the tree that matches will be selected.

Each Intent contains a :code:`multi-pipeline` and a :code:`single-pipeline`. These objects are lists of tuples of the form
:code:`[('name', TransformerObject()),...]` and are used by Preprocessor to construct sklearn Pipeline objects.
Expand Down
2 changes: 1 addition & 1 deletion foreshadow/intents/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def priority_traverse(cls):
node = lqueue.pop(0)
if len(node.children) > 0:
node_children = map(registry_eval, node.children)
lqueue.extend(node_children)
lqueue[0:0] = node_children # Append to beginning to do depth first

@classmethod
@check_base
Expand Down
2 changes: 1 addition & 1 deletion foreshadow/tests/test_intents/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ class TestIntent12(TestIntent1):
def is_intent(cls, df):
return True

class_list = [TestIntent, TestIntent1, TestIntent2, TestIntent11, TestIntent12]
class_list = [TestIntent, TestIntent1, TestIntent11, TestIntent12, TestIntent2]
assert class_list == list(TestIntent.priority_traverse())
_unregister_intent(list(map(lambda x: x.__name__, class_list)))

0 comments on commit 9a4b577

Please sign in to comment.