Skip to content

BalancingLearner of SequenceLearners does not finish calculation #213

@andrenmelo

Description

@andrenmelo

The following code fails to finish the calculation

import adaptive
adaptive.notebook_extension()

def dummy(x):
    return x

sequence = range(20)
learners = [adaptive.SequenceLearner(dummy, sequence)]
bl = adaptive.BalancingLearner(learners)
runner = adaptive.Runner(bl, lambda bl: all([l.done() for l in bl.learners]), 
                         log=True)
runner.live_info()

The error is happening in runner._get_futures(). I think something goes wrong when the runner asks for more points then there are points left in sequence.

Activity

andrenmelo

andrenmelo commented on Sep 4, 2019

@andrenmelo
Author

The log is just
[('ask', 48)]

akhmerov

akhmerov commented on Sep 4, 2019

@akhmerov
Contributor

As a temporary workaround you can use a single sequence learner (there's nothing to balance really).

andrenmelo

andrenmelo commented on Sep 4, 2019

@andrenmelo
Author

Oh that was just a minimal example. In reality I have a bunch of sequence learners.

akhmerov

akhmerov commented on Sep 4, 2019

@akhmerov
Contributor

I mean that also if you have a bunch of sequence learners, you can directly combine and shuffle the sequences. Since all the values are predefined, balancing learner does not bring any advantage as far as I can tell.

added a commit that references this issue on Sep 4, 2019
884674a
basnijholt

basnijholt commented on Sep 4, 2019

@basnijholt
Member

It should work with the fix in #214.

I will test a bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @akhmerov@basnijholt@andrenmelo

      Issue actions

        BalancingLearner of SequenceLearners does not finish calculation · Issue #213 · python-adaptive/adaptive