Refactor AdeftClassifier so that different forms of models can be swapped in, plus some minor cleanup #82
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.
The primary purpose of this PR is to refactor
AdeftClassifier
to make it easier to use other forms of models besides logistic regression with tfidf features. Rather than hardcoding the model type intoAdeftClassifier
,AdeftClassifier
now takes a parameterestimator
. I've written this in such a way to maintain backwards compatibility. I've written the estimator classBaselineModel
which implements the current adeft models, and made this the default inAdeftClassifier
. I have not defined an abstract base class yet for estimators used inAdeftClassifier
, but plan to do so when I start working on adding other model types. The intention of this PR is simply to lay the groundwork for future improvements. There was some shuffling around required to make this all work out.Also included in this PR are:
str2filename
for mapping model names to safe filenames, which is needed since we use model names as filenames, and used to be contained inadeft_indra
under a different name before I accidentally removed it from there without replacing it somewhere else 4 years ago.I will follow this PR up with a PR improving the validation of adeft models, allowing for fair comparisons between models of different types.