Closed desilinguist closed 4 years ago
Hello @desilinguist! Thanks for updating this PR.
tests/test_classification.py
:Line 1802:101: E501 line too long (107 > 100 characters)
Not sure why it doesn't show here but the Travis builds are actually complete.
Actually, this is not done - just found another simplification I can make. Please don't review it yet.
Merging #622 into master will decrease coverage by
0.04%
. The diff coverage is93.98%
.
@@ Coverage Diff @@
## master #622 +/- ##
==========================================
- Coverage 95.15% 95.10% -0.05%
==========================================
Files 26 27 +1
Lines 3031 3083 +52
==========================================
+ Hits 2884 2932 +48
- Misses 147 151 +4
Impacted Files | Coverage Δ | |
---|---|---|
skll/learner/utils.py | 94.94% <93.52%> (-0.94%) |
:arrow_down: |
skll/learner/__init__.py | 96.24% <94.73%> (+0.13%) |
:arrow_up: |
skll/__init__.py | 100.00% <100.00%> (ø) |
|
skll/experiments/__init__.py | 95.19% <100.00%> (ø) |
|
skll/utils/commandline/generate_predictions.py | 98.59% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 7e413e8...e876bbb. Read the comment docs.
@bndgyawali @mulhod @aoifecahill this is now ready for review. The minor code coverage decrease is expected due to the refactoring.
As I was working on implementing a
VotingLearner
class (for #488), I realized that this implementation would end up sharing a lot of the code with methods for theLearner
class. One way to handle this is to makeVotingLearner
inherit fromLearner
but that's not really right because, in fact,VotingLearner
uses multiple underlyingLearner
instances. So, the solution I came up with is to refactor as much of this shared code into functions inlearner.utils
that can the be used by bothLearner
instances as well asVotingLearner
instances (and, hopefully,StackingLearner
instances too, when we get to those).Specifically, this PR refactors:
Learner.evaluate()
intolearner.utils.compute_evaluation_metrics()
.Learner.predict()
intolearner.utils.write_predictions()
.Learner.evaluate()
intolearner.utils.add_unseen_labels()
.Learner._compute_num_folds_from_example_counts()
intolearner.utils.compute_num_folds_from_example_counts()
.Learner.predict()
intolearner.utils.get_predictions()
.Learner.cross_validate()
intolearner.utils.setup_cv_fold_iterator()
.Learner.learning_curve()
intolearner.utils.setup_cv_split_iterator()
.In addition, This PR closes #621 and adds a test to make sure that the predictions being returned and written out via
Learner.predict()
match expectations. As part of this fix, the default value of theclass_labels
keyword argument forLearner.predict()
is now set toTrue
instead ofFalse
since it doesn't make sense to return class indices by default. 💥 This will be a an API-breaking change since to get class probabilities as outputs,class_labels
will explicitly need to be set toFalse
. 💥Finally, this PR improves many docstrings, replaces single quotes with double quotes in some places, and replaces the old-style
format
strings with new-style ones in some of the code that was touched.