snowflake.ml.model.model_signature.infer_signature¶
- snowflake.ml.model.model_signature.infer_signature(input_data: Union[pd.DataFrame, ndarray[Any, dtype[Union[np.int8, np.int16, np.int32, np.int64, np.float32, np.float64, np.uint8, np.uint16, np.uint32, np.uint64, np.bool_, np.str_, np.bytes_]]], Sequence[Union[ndarray[Any, dtype[Union[np.int8, np.int16, np.int32, np.int64, np.float32, np.float64, np.uint8, np.uint16, np.uint32, np.uint64, np.bool_, np.str_, np.bytes_]]], torch.Tensor, tensorflow.Tensor, tensorflow.Variable]], Sequence[Union[int, float, bool, str, bytes, _SupportedBuiltinsList]]], output_data: Union[pd.DataFrame, ndarray[Any, dtype[Union[np.int8, np.int16, np.int32, np.int64, np.float32, np.float64, np.uint8, np.uint16, np.uint32, np.uint64, np.bool_, np.str_, np.bytes_]]], Sequence[Union[ndarray[Any, dtype[Union[np.int8, np.int16, np.int32, np.int64, np.float32, np.float64, np.uint8, np.uint16, np.uint32, np.uint64, np.bool_, np.str_, np.bytes_]]], torch.Tensor, tensorflow.Tensor, tensorflow.Variable]], Sequence[Union[int, float, bool, str, bytes, _SupportedBuiltinsList]]], input_feature_names: Optional[List[str]] = None, output_feature_names: Optional[List[str]] = None) ModelSignature ¶
Infer model signature from given input and output sample data.
Currently supports inferring model signatures from the following data types:
- Pandas DataFrame with columns of supported data types, lists (including nested lists) of supported data types,
and NumPy arrays of supported data types. - Does not support DataFrame with CategoricalIndex column index.
NumPy arrays of supported data types.
Lists of NumPy arrays of supported data types.
Lists of supported data types or nested lists of supported data types.
When inferring the signature, a ValueError indicates that the data is insufficient or invalid.
When it might be possible to create a signature reflecting the provided data, but it could not be inferred, a NotImplementedError is raised
- Args:
input_data: Sample input data for the model. output_data: Sample output data for the model. input_feature_names: Names for input features. Defaults to None. output_feature_names: Names for output features. Defaults to None.
- Returns:
A model signature inferred from the given input and output sample data.