You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Be more tolerant in check_array for CalibratedClassifierCV #13077
However, we currently cannot use it because our inputs can be 3D (example: pairs=[[[2.3, 5.4], [4.4, 5.6]], [[7.5, 1.2], [4.4, 5.6]]]), and CalibratedClassifierCV uses check_array with default parameters that does not allow 3D inputs.
However, other meta-estimators like GridSearchCV do not call check_array, so we can use them easily in metric-learn.
Is the check_array in CalibratedClassifierCV really useful or could we do without it ? If we could, I'd be happy to provide a PR to do so
I just tested and the following checks in test_non_meta_estimators do not work (the rest of scikit-learn's tests work): check_sample_weights_pandas_series, check_estimators_empty_data_messages, check_classifier_data_not_an_array, check_classifiers_train, check_classifiers_train(readonly_memmap=True), check_supervised_y_no_nan. However, if I add allow_nd=True in the check_array, every test work. I could just change that, but I also noticed several things:
CalibratedClassifierCV in fact does not inherit from MetaEstimatorMixin. Is it normal ? If it was, it wouldn't have to pass all these tests. However, I believe some of these tests should be tested and are not tested right now on meta-estimators, like check_sample_weights_pandas_series, check_classifier_data_not_an_array, (and maybe check_classifiers_train). Should I add them to tests on meta-estimators ?
I noticed that GridSearchCV uses _safe_split in order to support dataframes for instance, when splitting for the CV (which for CalibratedClassifierCV would solve check_sample_weights_pandas_series, check_classifier_data_not_an_array, and check_classifiers_train). Is it preferable to check_array(allow_nd=True) ?
EDIT: Now that I think about it and after what @jnothman said about MetaEstimator doing little (#13485 (comment)), I don't think assumptions (or non-assomptions) on the input data are part of the definition of a MetaEstimator in the end, so maybe there's no need to add these tests for MetaEstimator
I don't think assumptions (or non-assomptions) on the input data are part of the definition of a MetaEstimator in the end,
I don't think it's part of the assumptions, but I think that as a library, scikit-learn should do what it can to place minimal constraints on the data in the case of meta-estimators. What is minimal will depend on the meta-estimator, however, so I'm not sure common tests is the right solution.
I don't think it's part of the assumptions, but I think that as a library, scikit-learn should do what it can to place minimal constraints on the data in the case of meta-estimators. What is minimal will depend on the meta-estimator, however, so I'm not sure common tests is the right solution.
Activity
jnothman commentedon Feb 3, 2019
wdevazelhes commentedon Feb 4, 2019
I just tested and the following checks in
test_non_meta_estimatorsdo not work (the rest of scikit-learn's tests work):check_sample_weights_pandas_series,check_estimators_empty_data_messages,check_classifier_data_not_an_array,check_classifiers_train,check_classifiers_train(readonly_memmap=True),check_supervised_y_no_nan. However, if I addallow_nd=Truein thecheck_array, every test work. I could just change that, but I also noticed several things:CalibratedClassifierCVin fact does not inherit fromMetaEstimatorMixin. Is it normal ? If it was, it wouldn't have to pass all these tests. However, I believe some of these tests should be tested and are not tested right now on meta-estimators, likecheck_sample_weights_pandas_series,check_classifier_data_not_an_array, (and maybecheck_classifiers_train). Should I add them to tests on meta-estimators ?GridSearchCVuses_safe_splitin order to support dataframes for instance, when splitting for the CV (which forCalibratedClassifierCVwould solvecheck_sample_weights_pandas_series,check_classifier_data_not_an_array, andcheck_classifiers_train). Is it preferable tocheck_array(allow_nd=True)?EDIT: Now that I think about it and after what @jnothman said about
MetaEstimatordoing little (#13485 (comment)), I don't think assumptions (or non-assomptions) on the input data are part of the definition of aMetaEstimatorin the end, so maybe there's no need to add these tests forMetaEstimatorconnorbrinton commentedon Apr 1, 2019
I think this issue is also related to #8710, which has to do with
CalibratedClassifierCV's input validation in a pipeline contextjnothman commentedon Apr 4, 2019
I don't think it's part of the assumptions, but I think that as a library, scikit-learn should do what it can to place minimal constraints on the data in the case of meta-estimators. What is minimal will depend on the meta-estimator, however, so I'm not sure common tests is the right solution.
wdevazelhes commentedon Apr 4, 2019
I understand, that makes sense
bellet commentedon Apr 4, 2019
So would the addition of
allow_nd=Truein thecheck_arraybe the way to go then?