You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@madlib.apache.org by iyerr3 <gi...@git.apache.org> on 2017/07/28 16:37:15 UTC

[GitHub] incubator-madlib pull request #156: DT: Add option to treat NULL as category

GitHub user iyerr3 opened a pull request:

    https://github.com/apache/incubator-madlib/pull/156

    DT: Add option to treat NULL as category

    This commit adds an option to treat NULL as a level in the categorical
    feature. The level is added as a string (instead of a NULL value) to
    ensure MADlib arrays don't have NULLs in them during the binning
    procedure.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/iyerr3/incubator-madlib feature/dt_null_handling

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-madlib/pull/156.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #156
    
----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-madlib issue #156: DT: Add option to treat NULL as category

Posted by ivannovick <gi...@git.apache.org>.
Github user ivannovick commented on the issue:

    https://github.com/apache/incubator-madlib/pull/156
  
    thank you for this!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-madlib pull request #156: DT: Add option to treat NULL as category

Posted by iyerr3 <gi...@git.apache.org>.
Github user iyerr3 commented on a diff in the pull request:

    https://github.com/apache/incubator-madlib/pull/156#discussion_r131048326
  
    --- Diff: src/ports/postgres/modules/recursive_partitioning/decision_tree.py_in ---
    @@ -825,22 +855,34 @@ def _get_bins(schema_madlib, training_table_name,
                             ({{col}})::text AS levels,
                             {{order_fun}} AS dep_avg
                         FROM {training_table_name}
    -                    WHERE {filter_null}
    -                        AND {{col}} is not NULL
    +                    WHERE {filter_str}
                         GROUP BY {{col}}
    +                    {union_null_proxy}
                     ) s
                 ) s1
                 WHERE array_upper(levels, 1) > 1
                 """.format(training_table_name=training_table_name,
    -                       filter_null=filter_null)
    +                       filter_str=filter_str,
    +                       union_null_proxy=union_null_proxy)
    +
    +        all_col_expressions = {}
    +        for col in cat_features:
    +            if col in boolean_cats:
    +                all_col_expressions[col] = ("(CASE WHEN " + col +
    +                                            " THEN 'True' ELSE 'False' END)")
    +            else:
    +                # if null_proxy is not None:
    +                #     all_col_expressions[col] = ("COALESCE({0}, {1})".
    +                #                                 format(col, null_proxy))
    +                # else:
    --- End diff --
    
    Not needed - will take it out before merging. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-madlib pull request #156: DT: Add option to treat NULL as category

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-madlib/pull/156


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-madlib pull request #156: DT: Add option to treat NULL as category

Posted by njayaram2 <gi...@git.apache.org>.
Github user njayaram2 commented on a diff in the pull request:

    https://github.com/apache/incubator-madlib/pull/156#discussion_r131024096
  
    --- Diff: src/ports/postgres/modules/recursive_partitioning/decision_tree.py_in ---
    @@ -825,22 +855,34 @@ def _get_bins(schema_madlib, training_table_name,
                             ({{col}})::text AS levels,
                             {{order_fun}} AS dep_avg
                         FROM {training_table_name}
    -                    WHERE {filter_null}
    -                        AND {{col}} is not NULL
    +                    WHERE {filter_str}
                         GROUP BY {{col}}
    +                    {union_null_proxy}
                     ) s
                 ) s1
                 WHERE array_upper(levels, 1) > 1
                 """.format(training_table_name=training_table_name,
    -                       filter_null=filter_null)
    +                       filter_str=filter_str,
    +                       union_null_proxy=union_null_proxy)
    +
    +        all_col_expressions = {}
    +        for col in cat_features:
    +            if col in boolean_cats:
    +                all_col_expressions[col] = ("(CASE WHEN " + col +
    +                                            " THEN 'True' ELSE 'False' END)")
    +            else:
    +                # if null_proxy is not None:
    +                #     all_col_expressions[col] = ("COALESCE({0}, {1})".
    +                #                                 format(col, null_proxy))
    +                # else:
    --- End diff --
    
    Do we need to keep these commented lines?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-madlib issue #156: DT: Add option to treat NULL as category

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit commented on the issue:

    https://github.com/apache/incubator-madlib/pull/156
  
    
    Refer to this link for build results (access rights to CI server needed): 
    https://builds.apache.org/job/madlib-pr-build/131/



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---