snowflake.ml.model.model_signature.ParamGroupSpec

class snowflake.ml.model.model_signature.ParamGroupSpec(name: str, specs: list[snowflake.ml.model._signatures.core.BaseParamSpec], default_value: Optional[Any] = None, shape: Optional[tuple[int, ...]] = None)

Bases: BaseParamSpec

Specification of a group of parameters in Snowflake native model packaging.

Initialize a parameter group.

Parameters:
  • name – Name of the parameter group.

  • specs – A list of parameter specifications that composes the group.

  • default_value – Explicit default value for the group. If None, the default is computed from child specs.

  • shape – Shape of the parameter group. 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 MapType representing an OBJECT in Snowflake. If shape is specified, wraps the base type in ArrayType.

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

Deserialize the parameter group from a dict.

Parameters:

input_dict – The dict containing information of the parameter group.

Returns:

A parameter group instance deserialized and created from the dict.

classmethod from_mlflow_spec(param_spec: mlflow.types.ParamSpec) ParamGroupSpec

Convert an MLflow ParamSpec with Object dtype to a ParamGroupSpec.

Parameters:

param_spec – An mlflow.types.ParamSpec whose dtype is mlflow.types.schema.Object.

Returns:

A ParamGroupSpec with child specs for each property.

to_dict() dict[str, Any]

Serialize the parameter group into a dict.

Returns:

A dict that serializes the parameter group.

Attributes

default_value

Default value of the parameter group.

If an explicit default was provided at construction, it is returned as-is. Otherwise, computes a default from child specs: - Without shape: returns a dict mapping parameter names to their default values. - With shape: returns a nested list structure where each leaf is the default dict. Variable-length dimensions (-1) result in empty arrays. Nested ParamGroupSpecs produce nested dicts (or arrays if they have shape).

Returns:

The explicit default value, or a computed dict/nested list of dicts.

dtype

Type of the parameter group. Always OBJECT.

name

Name of the parameter.

shape

Shape of the parameter. None means scalar.

specs

List of parameter specifications in the group.