Skip to content
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

Bugfixes and change to default behavior of get_rules #18

Merged
merged 4 commits into from Mar 25, 2018

Conversation

dchristle
Copy link
Contributor

I fixed two bugs I ran into:

  1. If one of the feature columns has a constant feature, then its standard deviation will be zero, and the friedman scaling done will have a divide by 0 error. I added a small constant to prevent this division by zero.

  2. If Cs is passed to RuleFit when instantiating the object, it won't be passed properly to the LogisticRegression subroutine -- it should be self.Cs, instead of Cs.

I also ran into quirky behavior with get_rules versus transform. When transforming, I would get out a matrix with 116 columns, corresponding to 116 transformed features. When inspecting the rules with the output of get_rules, the total number of rules would only be 115. This was pretty frustrating, but I tracked down the source of the issue to be that when exclude_zero_coef was set to True, one of the rules was being eliminated. I think that the behavior between get_rules and transform should be identical -- either the variables with zero coefficient are eliminated from both, or neither. So this change at least makes the two consistent.

David Christle and others added 4 commits March 2, 2018 10:56
… creating a RuleFit object, this fails since self.Cs exists and Cs is null.
…set to true, the behavior between transform (which does not appear to drop coefficients with 0) and the behavior of get_rules are different, which was very confusing to me. I could not understand why the transformed output had one more row than the total number of decision tree rules I retrieved using the get_rules method.
@christophM
Copy link
Owner

Thanks for the fixes!

@christophM christophM merged commit 0b65f7a into christophM:master Mar 25, 2018
@chriswbartley
Copy link
Collaborator

Seconded, thank you David.

@danallison danallison mentioned this pull request Jun 18, 2018
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.

None yet

3 participants