2011/10/26 Jacob VanderPlas <[email protected]>: > Olivier Grisel wrote: >> A note for the scikit-learn developers: >> >> => we should definitely improve the tooling for checking the input and >> emit informative ValueError messages that state explicitly that >> scipy.sparse matrices are not supported as input for the models >> mentioned by the poster. >> > > Would it be worth creating an input-checking utility that would give > unified output across scikit-learn? I'm thinking something like > > utils.check_input(X, array=True, matrix=True, sparse=False) > > which would let a np array or matrix pass through, but raise an > informative error for a sparse format. We could extend this to other > types, or even allow dimensionality checks as well.
larsmans already started to work on uniformizing those checks and there is already: https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/__init__.py#L60 https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/__init__.py#L65 https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/utils/__init__.py#L93 However `array2d` should be improved to explicitly reject scipy.sparse matrices with an explicit error message. And `check_arrays` parameter `sparse_format` should be extended to add the value `invalid` (or `reject` for instance) that raises a ValueError with the same explicit message as well. -- Olivier http://twitter.com/ogrisel - http://github.com/ogrisel ------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
