[Tests][Warnings] Cut all warnings from SCML using a minimal solution #341
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_basis
value when its possible.As all test run the iris dataset for SCML though
build_triplets
attest_utils.py
, then we just need to scpecifyn_basis
forSCML
andSCML_Supervised
in the lists.Going through the code of
SCML
, ifn_basis
isNone
, 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_Supervised
and 320 forSCML
.I changed it, but got the following tests failing.
test_components_is_2D
attest_mahalanobis_mixin.py
there 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
fit
for 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
,TestSklearnCompat
class,test_scml
,check_estimator
function ifn_basis
is arbitrary, because under the hood it callsfit()
wich calls_generate_bases_LDA
, and ifn_basis
is wrong, it may fail. Thus, we need to letSCML
calcn_basis
for us as we don't know wich randomX, y
dataset is being used. Thus, we need to usepytest.warn
to catch the warning.Not an error, but an obervation in
test_triplet_diffs
andtest_lda
: These tests needs an explicitlyn_basis=None
to 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.py
previously.Best! 🎃