Open
Labels
RoadmapLarger, self-contained pieces of work.
Description
Should we add a compute keyword to all the fit / partial_fit on estimators we implement?
This would aid with
- debugging the graphs we build
- Better scheduling (any examples here?)
This is somewhat difficult. As @jcrist summarized in dask/dask-searchcv#19
Lazy evaluation conflicts with scikit-learn's api, and is tricky to support here in a way that is both intuitive and robust. For some configurations there is also the need to call get multiple times, which prevents lazy evaluation.
xref #259
Metadata
Metadata
Assignees
Labels
RoadmapLarger, self-contained pieces of work.
Activity
mrocklin commentedon Jul 3, 2018
Incremental with many parameters. We're prefer to build one large graph that gets a bit of data, passes it around to all of the models, gets the next bit of data, etc.. I think that we (you) did this manually using a
compute=Falsebit of code while at BIDS.stsievert commentedon Jul 4, 2018
I fit and score serially in dask/dask-examples#15:
There's no reason for this to be serial – it can start training the next iteration while scoring the previous iteration.
mrocklin commentedon Jul 12, 2018
So it looks like the current fit functions tend to both do some computation, and then also finalize things back onto the collection. This finalization step seems to be what makes this problem hard if we also want to maintian the scikit-learn API.
I wonder if we might use the full Dask collections API here and make use of
__dask_finalize__.cc @jcrist
mrocklin commentedon Jul 12, 2018
Looks like I meant
__dask_postcompute__rather than__dask_finalize__TomAugspurger commentedon Jul 12, 2018
I'll play with that a bit today to see how things feel.
What would you expect the output of
Incremental(sgd).fit(X, y, compute=False)to be? ADelayedobject or anIncremental(which implements the dask collections API)? I'm leaning towards an Incremental.TomAugspurger commentedon Jul 12, 2018
Although, thinking a bit further, when you try to do anything with a "delayed Incremental.fit`, it feels a lot like a dask.Delayed object.
mrocklin commentedon Jul 12, 2018
I think that it would be another
Incrementalobject.coef_andscoreare probably dask delayed objects, but in some cases they might also be dask arrays. I don't think that these strongly affect what we choose to make the result of.fit()js3711 commentedon Jul 19, 2018
Probably getting ahead of myself but dask grid search cv will likely also need to be modified to allow for delayed fit methods. This could be desireable for the new bagging estimator
markkoob commentedon Aug 29, 2019
I would like to build a high level graph which performs several RandomizedSearchCVs across different estimator types in parallel, possibly with different data sets, using a distributed system. What I find is that any attempt to client.submit() a graph containing a delayed .fit() hangs on the worker with no callstack or with this callstack:
Reading this (and other) issues, I think the behavior I see is expected and that this feature would fix it. If I am wrong and this is expected to work I'm happy to produce a concise test example.
TomAugspurger commentedon Aug 30, 2019
@markkoob that may be a bit surprising. Are you passing dask objects to the delayed fit, or NumPy / pandas objects?
markkoob commentedon Aug 30, 2019
I'm not certain I've tried fitting with dask.DataFrame types on the distributed client with a delayed fit, but I'm pretty sure I've tried most other combinations. I'll give that one a shot and try building a testcase that shows the behavior on a local cluster object.
markkoob commentedon Aug 30, 2019
Okay I've been able to reproduce a couple of things with the LocalCluster. Hopefully that means I'm just doing something wrong!
I'm still trying to figure out how to get the acquire hang to happen predictably, but I'm starting to suspect it might be specific to delayed unpickling which was a shortcut I was taking for testing purposes and not necessarily a part of my use case.
MatthewLennie commentedon Apr 22, 2021
Hey all,
IMO, lazy fit will be a fantastic addition. I had some real pain using the StandardScaler with the column transformer because it called compute for each column. I have built here a rough prototype that implements scalers as a custom collection which was hinted at by @mrocklin and perhaps an approach like this may be the future. Would love to hear your thoughts. I think it would also have the advantage the ColumnsTranformers could be built on top of this in the same way thus using the HighLevelGraph from each of the scalers.
MatthewLennie commentedon Apr 26, 2021
Further to my previous comment.
A rough idea of a Column transformer implementation could be done thusly. This would just work with data in the form of dataframes, but that can obviously be extended easily enough. Also scalers can be turned into a property etc.. this is just a quick and dirty prototype, but I think a good start for discussion.