cblearn.utils.check_query#
- cblearn.utils.check_query(query, result_format=None)[source]#
Input validation for queries.
Checks query shape and datatype. Converts between array (T-STE style) and sparse matrix format for query.
- Parameters:
- Returns:
If response_format=’tensor’, a three-dimensional sparse.COO matrix is returned. The three dimensions all have size ‘n_objects’. The entry query[i, j, k] indicates the response on ij <= jk. It is -1 if wrong, 0 if undecidable, and 1 if correct.
If response_format=’list’, a numpy array of shape (n_samples, 3) is returned. Each row (i, j, k) indicates, ij <= ik.
- Raises:
ValueError – If the array_like input has the wrong shape, or response types cannot be converted. This happens e.g. if undecided (0) response, should be converted to ordered or boolean response.
- Return type: