snowflake.ml.model.model_signature.FeatureGroupSpec¶
- class snowflake.ml.model.model_signature.FeatureGroupSpec(name: str, specs: list[BaseFeatureSpec], shape: tuple[int, ...] | None = None)¶
Bases:
BaseFeatureSpecSpecification of a group of features in Snowflake native model packaging.
Initialize a feature group.
- Parameters:
name – Name of the feature group.
specs – A list of feature specifications that composes the group. All children feature specs have to have name. And all of them should have the same type.
shape –
Used to represent scalar feature, 1-d feature list, or n-d tensor. Use -1 to represent variable length. Defaults to None.
Examples
None: scalar
(2,): 1d list with a fixed length of 2.
(-1,): 1d list with variable length, used for ragged tensor representation.
(d1, d2, d3): 3d tensor.
Methods
- as_dtype(force_numpy_dtype: bool = False) type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | Int8Dtype | Int16Dtype | Int32Dtype | Int64Dtype | UInt8Dtype | UInt16Dtype | UInt32Dtype | UInt64Dtype | Float32Dtype | Float64Dtype | BooleanDtype | StringDtype¶
Convert to corresponding local Type.
- as_snowpark_type() DataType¶
Convert to corresponding Snowpark Type.
- classmethod from_dict(input_dict: dict[str, Any]) FeatureGroupSpec¶
Deserialize the feature group from a dict.
- Parameters:
input_dict – The dict containing information of the feature group.
- Returns:
A feature group instance deserialized and created from the dict.
- to_dict() dict[str, Any]¶
Serialize the feature group into a dict.
- Returns:
A dict that serializes the feature group.
Attributes
- name¶
Name of the feature.