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

SegmentedRegressionModel #32

Merged
merged 6 commits into from
Jun 5, 2014
Merged

SegmentedRegressionModel #32

merged 6 commits into from
Jun 5, 2014

Conversation

jiffyclub
Copy link
Member

This adds a SegmentedRegressionModel class that falls in between a single RegressionModel and a RegressionModelGroup in terms of configurability. As with RegressionModelGroup you can specify models individually per segment, but filters apply globally across all segments and are in fact applied before doing and fit or prediction on the segments.

The SegmentedRegressionModel may optionally be configured with a default model and ytransform that can be overridden for individual segments.

If not a Series it should refer to a column in the choosers table.
We're usually passing in a column from the choosers table anyway,
so it makes sense to allow it to be specified this way.
This is somewhere between a RegressionModel and the
RegressionModelGroup. Unlike the group the individual models are not
fully configurable: only the model expression and ytransform can be
customized. Fit and predict filters are global across all segments.

YAML interface is still to be done.
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling dcd1e24 on segmented-regression into * on master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 8e0ddb8 on segmented-regression into * on master*.

@jiffyclub
Copy link
Member Author

Another feature of SegmentedRegressionModel is that segments don't need to be explicitly added if they'll have the same model and ytransform as the defaults. When you call .fit and segment that wasn't explicitly added will be automatically added with the default model expression and ytransform.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 7f7b16d on segmented-regression into * on master*.

This appears to be working with my workflow where I edit the yaml directly.  The biggest issue was when using numpy types as the segmented keys (when building_type_ids are ints).  Also edited the yamlmodelrunner to peek into the config file and choose the segmented or non-segmented model based on the model_type.  I will definitely be making these segmented models most of the time so I'm not sure if the forking strategy is really necessary.
@coveralls
Copy link

Coverage Status

Coverage increased (+1.66%) when pulling 30538de on segmented-regression into 76379e8 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.56%) when pulling bcbc5f0 on segmented-regression into 76379e8 on master.

fscottfoti added a commit that referenced this pull request Jun 5, 2014
Adding the segmented regression model.
@fscottfoti fscottfoti merged commit eb413d2 into master Jun 5, 2014
@fscottfoti fscottfoti deleted the segmented-regression branch June 5, 2014 22:16
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