[Tests][Warnings] Cut all warnings from SCML using a minimal solution #341
+34
−35
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.
As suggested by @bellet in #339, it's better to cut SCML warnings from the root by specifying the
n_basisvalue when its possible.As all test run the iris dataset for SCML though
build_tripletsattest_utils.py, then we just need to scpecifyn_basisforSCMLandSCML_Supervisedin the lists.Going through the code of
SCML, ifn_basisisNone, then the following default is assigned:Default for SCML_Supervised: (lines 579-583)
Default for SCML: (line 234)
Iris dataset has 150 samples, 3 classes, 4 features. So the value is 80 for
SCML_Supervisedand 320 forSCML.I changed it, but got the following tests failing.
test_components_is_2Dattest_mahalanobis_mixin.pythere is an error because of a border case. I got this warning from SCML:And this error from the test:
So the test want to test
fitfor just one feature. Right now the feature selected from Iris is the 1st one, but if we use 2nd dimension instead, we can avoid this border case and make the test pass. The behavior expected is the same.There is also an error in
test_sklearn_compat.py,TestSklearnCompatclass,test_scml,check_estimatorfunction ifn_basisis arbitrary, because under the hood it callsfit()wich calls_generate_bases_LDA, and ifn_basisis wrong, it may fail. Thus, we need to letSCMLcalcn_basisfor us as we don't know wich randomX, ydataset is being used. Thus, we need to usepytest.warnto catch the warning.Not an error, but an obervation in
test_triplet_diffsandtest_lda: These tests needs an explicitlyn_basis=Noneto check if it is being set correctly internally, thus, in this case the warning needs to be caught as well.Besides this observations, all warnings from SCML were removed. Only 300-ish warnings are shown now across all tests.
Also, this PR removes the
isinstance()overkill made intest_triplets_clasifiers.pypreviously.Best! 🎃