Proof of concept for allowing non-sklearn estimators #160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure if there is any desire for this feature, but in this PR I have sketched out a way to use virtually any estimator type with the
ActiveLearnerandBayesianOptimizerclasses.Motivation
Allow us to use other training and inference facilities, such as HuggingFace models that are trained using the
Trainerclass, use AWS SageMakerEstimators, etc. With this added flexibility, the training and inference does not need to even run on the same hardware as themodALcode. This brings the suite of sampling methods here to many new applications, particularly resource-intensive deep learning models that typically don't fit that great under thesklearninterface.Implementation
Rather than call the classic
sklearnestimator functions such asfit,predict,predict_proba, andscore, this PR adds a layer of callables that can be overridden:fit_func,predict_func,predict_proba_func, andscore_func.I added SKLearn implementations of each by default (included their corresponding
Protocolclasses as well). Here's howfitworks:I'll also note that the changes in this PR don't break any of the existing tests.
Usage
When using SageMaker, we might implement
fitandpredict_probain this manner:If you've made it this far, I'd ask that you forgive the clunkiness. This was a rough sketch of an idea I wanted to get written down before I forgot it. Anyways, would love some feedback, and if you think this PR is worth finishing, let me know. I can say for me, this would unlock a lot of really useful applications.