snowflake.ml.model.model_signature.ParamSpec

class snowflake.ml.model.model_signature.ParamSpec(name: str, dtype: DataType, default_value: Any, shape: Optional[tuple[int, ...]] = None)

Bases: BaseParamSpec

Specification of a parameter in Snowflake native model packaging.

Initialize a parameter.

Parameters:
  • name – Name of the parameter.

  • dtype – Type of the parameter.

  • default_value – Default value of the parameter.

  • shape – Shape of the parameter. None means scalar, otherwise a tuple representing dimensions. Use -1 for variable length dimensions.

Methods

as_snowpark_type() DataType

Convert to corresponding Snowpark Type, accounting for shape.

Returns:

A Snowpark type. If shape is specified, wraps the base type in ArrayType.

classmethod from_dict(input_dict: dict[str, Any]) ParamSpec

Deserialize the parameter specification from a dict.

Parameters:

input_dict – The dict containing information of the parameter specification.

Returns:

The deserialized parameter specification.

Return type:

ParamSpec

classmethod from_mlflow_spec(param_spec: mlflow.types.ParamSpec) ParamSpec
to_dict() dict[str, Any]

Serialize the parameter specification into a dict.

Returns:

A dict that serializes the parameter specification.

Attributes

default_value

Default value of the parameter.

dtype

Type of the parameter.

name

Name of the parameter.

shape

Shape of the parameter. None means scalar.