cblearn.utils.check_format#
- cblearn.utils.check_format(format, default_query, default_response)[source]#
Validate comparison format description.
The format of comparison data is specified as a single string separated by ‘-’, or a tuple of format identifiers. Valid formats include ‘list-order’, ‘list-boolean’, ‘list-count’, and ‘tensor-count’. If the format is not explicitly given, the format used by the default_triplets and default_response is returned.
- Parameters:
format (str | Tuple[QueryFormat, ResponseFormat] | None) – Comparison format string ‘query-response’ or tuple of format strings (query, response).
default_query (ndarray | COO | spmatrix) – Comparison query to extract format from if not passed explicitly.
default_response (ndarray | None) – Comparison response to extract format from if not passed explicitly.
- Returns:
Tuple of format identifiers (query, response)
- Raises:
ValueError – Format identifier is unknown.
IndexError – Less than 2 format components.
- Return type:
Tuple[QueryFormat, ResponseFormat]