in src/sagemaker_xgboost_container/encoder.py [0:0]
def decode(obj, content_type):
# type: (np.array or Iterable or int or float, str) -> xgb.DMatrix
"""Decode an object ton a one of the default content types to a DMatrix object.
Args:
obj (object): to be decoded.
content_type (str): content type to be used.
Returns:
np.array: decoded object.
"""
try:
media_content_type, _params = cgi.parse_header(content_type)
decoder = _dmatrix_decoders_map[media_content_type]
return decoder(obj)
except KeyError:
raise _errors.UnsupportedFormatError(media_content_type)