-
Notifications
You must be signed in to change notification settings - Fork 58
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
Suggestion: hide the actual function to be evaluated from learners #93
Comments
originally posted by Joseph Weston (@jbweston) at 2018-01-31T11:03:22.033Z on GitLab At the moment we keep a reference to the learned function inside the learner. This is not a fundamental design decision, but merely done so that users only have to pass around 1 object (the learner) rather than keeping track of the function-learner pairing themselves. In all the concrete use-cases that we have encountered so far this seems to make the most sense. AFAICT the only fundamental difference between storing the function in the learner vs. not is the question of pickling. As you know the learner never actually accesses the property that is used to store the function; it is only accessed by Runners. The current runner assumes that OTOH, how would you implement the
This would IMO be better encapsulated by a learner that chooses points based not only on the where is best to learn the function, but also on the experimental constraints. |
originally posted by Christoph Groth (@cwg) at 2018-08-21T09:48:02.973Z on GitLab I didn't understand what I think that the current balancing learner could be changed to accept a learner class and a sequence of functions to be learned. That would work just as well as the current design. However, I think that the idea of doing the balancing in a learner is actually a bad one. I think that a clean design is to define learners as objects that learn some function over some domain, and runners as objects that know how to evaluate some function but ignore its structure. This provides for a clear separation of responsibilities. A runner takes care of, say, a parallel framework, or measuring, or async execution. A learner focuses on approximating a function that belongs to some class. So it makes sense to see the learner as an approximation of the function and it would be IMHO very natural to add a It seems to me that balancing should be rather something that is built into most runners. I don't see a reason why almost any runner shouldn't have this capability. It is also more natural given that a runner exploits some resource (say a computing cluster or a measuring apparatus), to let it distribute the work in an appropriate way. |
originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-08-21T19:59:29.253Z on GitLab Sounds like a reasonable design goal. We will need to think about the reorganization:
|
originally posted by Christoph Groth (@cwg) at 2018-08-21T20:26:21.309Z on GitLab Two additions to what I wrote above While I'm sure that learners shouldn't store functions, I do not insist on what I wrote about balacing being better done in runners. As we saw in the chat, there are cases where wrapping learners in other learners can be useful. For example, there could be a learner that applies some more basic learner to a whole family of similar functions that are parametrized somehow. Here's a symptom of the problems with current Now if the learner is made by I propose to replace this application of |
originally posted by Christoph Groth (@cwg) at 2018-08-21T20:49:20.684Z on GitLab Anton wrote:
Can today's The learning of a parametrized function family seems to be best realized by a
The
Learner: Runner: Executor: |
originally posted by Anton Akhmerov (@anton-akhmerov) at 2018-08-21T20:53:35.908Z on GitLab
Yes, but it is less nice, it presents a bunch of plots.
Yes, this seems to be the main useful case for balancing. |
originally posted by Bas Nijholt (@basnijholt) at 2018-09-24T11:38:55.719Z on GitLab We've been having this discussion for quite a while and there are reasons for doing both. Why to leave the
|
originally posted by Bas Nijholt (@basnijholt) at 2018-09-24T11:46:29.854Z on GitLab I also implemented this in https://gitlab.kwant-project.org/qt/adaptive/merge_requests/110. It shows for example how even the
|
(original issue on GitLab)
opened by Christoph Groth (@cwg) at 2018-01-20T14:43:17.989Z
Learners do not need to have access to the function object they are trying to predict. I believe that they should not have access to it.
Learners request points and are fed back results. At no point do they need to know how the results are actually obtained. Not knowing something that one does not need to know can be a good thing. Learners can be useful to predict all kinds of functions, not only things that can be represented well as a Python function.
Of course any way to obtain results can be expressed as a function (if necessary with internal state and blocking). But this can lead to considerable unnecessary complexity and inefficiency.
Examples:
The function to be learned is an asynchronous function, defined with
async def
. One can write a callable object that internally uses async programming and blocks on calls, but if this one is driven by something like the current runner (that uses asyncio itself), complexity rapidly explodes.The function to be learned is ran by a remote procedure call (over the network, using some messaging library) to one of 20 available nodes. The remote requests have to be collected, load-balanced and perhaps submitted in some particular way that is only known by the runner. Again, this can be all abstracted as a callable object, but the much better approach is to have a runner that is specific to that messaging library and knows how to deal with it.
The function to be learned is the measurement of some experiment that involves doing something mechanical (moving a robotic arm, say). As such, requests should be sorted by x coordinate, so that the arm has to move as little as possible. Again, a custom runner is the most elegant solution.
@jbweston, I'm not convinced by the argument that a learner should encapsulate everything needed, including what should be learned. IMHO the whole point of a learner is that it is useful without the function. E.g. it should be possible to pickle a learner without pickling the possible monstrosity of a function (that could make calls to some horrible DFT library) that it approximates.
The text was updated successfully, but these errors were encountered: