def __init__(original, self, *args, **kwargs): data = args[0] if len(args) > 0 else kwargs.get("data") if data is not None: try: if isinstance(data, str): raise Exception( "cannot gather example input when dataset is loaded from a file." ) input_example_info = _InputExampleInfo( input_example=deepcopy(data[:INPUT_EXAMPLE_SAMPLE_ROWS])) except Exception as e: input_example_info = _InputExampleInfo(error_msg=str(e)) setattr(self, "input_example_info", input_example_info) original(self, *args, **kwargs)
def __init__(self, *args, **kwargs): data = args[0] if len(args) > 0 else kwargs.get("data") original = gorilla.get_original_attribute(xgboost.DMatrix, "__init__") if data is not None: try: if isinstance(data, str): raise Exception( "cannot gather example input when dataset is loaded from a file." ) input_example_info = _InputExampleInfo( input_example=deepcopy(data[:INPUT_EXAMPLE_SAMPLE_ROWS])) except Exception as e: # pylint: disable=broad-except input_example_info = _InputExampleInfo(error_msg=str(e)) setattr(self, "input_example_info", input_example_info) original(self, *args, **kwargs)