Skip to content

Add better support for customization of runners #76

Open
@basnijholt

Description

@basnijholt

(original issue on GitLab)

opened by Joseph Weston (@jbweston) at 2018-06-11T08:35:40.607Z

We have several examples of adaptive usage where people need some functionality that sits between the Learner and the Runner.

Examples are

  • DataSaver: The learned function returns a bunch of information, and we want to learn only a part of this information (e.g. a dict is returned, and we want only to learn the values with key result), but also keep the full output, for future analysis
  • Timer: We want to time the execution of the learned function
  • Cache: We want to cache some information produced by function calls, to use it in other function calls

The fact that gitlab:!71 is necessary indicates that we need to think about the way that this 'middleware' is implemented. It may be that making (semi-)transparent wrappers for Learners is the right design, but we should make it clear that this is what we are doing, in this case.

At the moment runners execute (more or less) the following in a loops: x, _ = ask(); tell(x, f(x)) The idea with a middleware is that you'd place a pair of functions, g and h, in between f: x, _ = ask(); tell(x, g(f(h(x))). The question would then be what the exact signatures of g and h need to be (e.g. in the previous example g is not passed enough information to be able to associate the value it receives with a corresponding x value), and whether they are better modelled by a class, a generator, or whatever.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions