Skip to content

hsfs.transformation_function #

[source] TransformationFunction #

[source] NOT_FOUND_ERROR_CODE class-attribute instance-attribute #

NOT_FOUND_ERROR_CODE = 270160

DTO class for transformation functions.

PARAMETER DESCRIPTION
featurestore_id

int. Id of the feature store in which the transformation function is saved.

hopsworks_udf

HopsworksUDF. The meta data object for UDF in Hopsworks, which can be created using the @udf decorator.

version

int. The version of the transformation function.

id

int. The id of the transformation function in the feature store.

transformation_type

UDFType. The type of the transformation function. Can be "on-demand" or "model-dependent"

[source] id property writable #

id: id

Transformation function id.

[source] version property writable #

version: int

Version of the transformation function.

[source] hopsworks_udf property #

hopsworks_udf: HopsworksUdf

Meta data class for the user defined transformation function.

[source] transformation_type property writable #

transformation_type: TransformationType

Type of the Transformation: can be model dependent or on-demand.

[source] transformation_statistics property writable #

transformation_statistics: TransformationStatistics | None

Feature statistics required for the defined UDF.

[source] output_column_names property #

output_column_names: list[str]

Names of the output columns generated by the transformation functions.

[source] save #

save() -> None

Save a transformation function into the backend.

Example
# import hopsworks udf decorator
from hopworks import udf

# define function
@udf(int)
def plus_one(value):
    return value + 1

# create transformation function
plus_one_meta = fs.create_transformation_function(
        transformation_function=plus_one,
        version=1
    )

# persist transformation function in backend
plus_one_meta.save()

[source] delete #

delete() -> None

Delete transformation function from backend.

Example
# import hopsworks udf decorator
from hopworks import udf

# define function
@udf(int)
def plus_one(value):
    return value + 1

# create transformation function
plus_one_meta = fs.create_transformation_function(
        transformation_function=plus_one,
        version=1
    )
# persist transformation function in backend
plus_one_meta.save()

# retrieve transformation function
plus_one_fn = fs.get_transformation_function(name="plus_one")

# delete transformation function from backend
plus_one_fn.delete()

[source] alias #

alias(*args: str)

Set the names of the transformed features output by the transformation function.