Repository navigation
Conversation
|
Changes Unknown when pulling 0433295 on lbybee:distributed_estimation into * on statsmodels:master*. |
|
I would consider having a single generator that yields both endog and exog. There are several reasons for this:
|
|
Not sure what @josef-pkt thinks but perhaps |
|
(I haven't looked at pr yet) |
| estimation_method=None, estimation_kwds=None, | ||
| join_method=None, join_kwds=None): | ||
| """ | ||
| This functions handles a general approach to distributed estimation, |
There was a problem hiding this comment.
First line of docstring should be one line. Then blank line, then can have additional text that is longer than one line.
| along with the average gradient. For the OLS case, | ||
| approx_inv_cov is an approximation for | ||
|
|
||
| (1 / n X^T X)^{-1} |
There was a problem hiding this comment.
Is this correct? I think n * (X^T X)^{-1} is what you want?
| X^T(y - X^T params) | ||
| """ | ||
|
|
||
| grad = -mod.score(np.r_[params], **score_kwds) |
There was a problem hiding this comment.
np.asarray is preferable to np.r_ (I think np.r_ always makes a copy, even if not needed). You shouldn't need the copy here, but if you do I think params.copy() is more clear. If the only goal is to be sure that an ndarray is going into the score function, np.asarray will do that.
|
|
||
| where k corresponds to the index of the partition | ||
|
|
||
| For the simple linear case: |
There was a problem hiding this comment.
It's not really "simple linear" if there are more than 1 covariates, better to use "OLS" I think.
|
I believe that this should be ready to be merged whenever the pandas issue is solved since that is where the failures for the tests are coming from. |
|
This looks good, I will merge in a day or two if nobody objects. Once it's merged I will do some more testing and we can do a quick follow-up PR if needed. |
|
based on a brief look
I guess discussion and changes in this PR might be helpful to understand the development of the code, so I would suggest opening a new PR with a cleaned up history and rebased branch. |
|
@josef-pkt In regards to the tests, there are a number that do comparisons between distributed and non-distributed results, though they are further down in the testing file. I'm taking care of the commit cleanup now. |
Ok, I wanted to make a PR for this, there are still a couple of things that I need to fix but things are pretty close to done and I'm happy with the current approach.
The key part of the current approach is a function
distributed_estimation. This function works by taking a generator for endog and exog,endog_generatorandexog_generator, as well as a series of functions and key word arguments to be run on each machine and then used to recombine the results. The generator approach allows for a variety of use cases and can handle a lot of the ideas discussed in the initial proposal. For each data set yielded by the generators a model is initialized usingmodel_classandinit_kwdsand then the functionestimation_methodis applied to the model along with the key wordsfit_kwdsandestimation_kwds. Finally, the results are recombined from each data set usingjoin_method.Currently, this defaults to the distributed regularized approach discussed here:
http://arxiv.org/pdf/1503.04337v3.pdf
but the way I've set things up means that the user should be able to apply any number of procedures here.
The current todo list:
Let me know if there are any comments/questions/criticisms, as I've said, it certainly isn't complete but I wanted to get this out there so I can start integrating any changes as I finish it up.