Closed alexmill closed 4 years ago
Thanks, merged. I'll change the docs too to reflect what it does. That progress bar looks good, but is there some way of making it an optional dependency?
@david-cortes What is the minimum Python version required for this package? There is a way to only import a package if already installed, but the method for doing so depend on Python version.
There's no minimum required version, but I try to keep it as compatible as possible.
This commit modifies
evaluateRejectionSampling
so that, rather than iterating one-by-one through the dataset, rejections and rewards are evaluated in batches with numpy.I haven't fully tested this with partial_fit methods or for situations when nchoices>2, but it works great for the policies I've tried. It's reduced the runtime for me by 100-fold. The benefits of batch processing obviously scale with the size of the batch, but improvements are noticeable even for small batches.
I might suggest adding
tqdm
as a dependency and adding a progress bar to big loops like this. In this case, one could replacewith
This works great on my local version.
No pressure to merge, but this took me 10 minutes to write so I thought I'd make a pull request and share with the world (while I wait for my batches to run...). Cheers.