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_, np.datetime64]]], 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_, np.datetime64]]], 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_, np.datetime64]]], 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_, np.datetime64]]], 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, input_data_limit: Optional[int] = 100, output_data_limit: Optional[int] = 100) 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
- Parameters:
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.
input_data_limit – Limit the number of rows to be used in signature inference in the input data. Defaults to 100. If None, all rows are used. If the number of rows in the input data is less than the limit, all rows are used.
output_data_limit – Limit the number of rows to be used in signature inference in the output data. Defaults to 100. If None, all rows are used. If the number of rows in the output data is less than the limit, all rows are used.
- Returns:
A model signature inferred from the given input and output sample data.