Skip to content

hsfs.transformation_function #

TransformationFunction #

NOT_FOUND_ERROR_CODE class-attribute instance-attribute #

NOT_FOUND_ERROR_CODE = 270160

DTO class for transformation functions.

hopsworks_udf property #

hopsworks_udf: HopsworksUdf

Meta data class for the user defined transformation function.

id property writable #

id: id

Transformation function id.

output_column_names property #

output_column_names: list[str]

Names of the output columns generated by the transformation functions.

transformation_statistics property writable #

transformation_statistics: TransformationStatistics | None

Feature statistics required for the defined UDF.

transformation_type property writable #

transformation_type: TransformationType

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

version property writable #

version: int

Version of the transformation function.

alias #

alias(*args: str)

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

PARAMETER DESCRIPTION
args

The names of the transformed features. The number of names provided must match the number of output features of the transformation function.

TYPE: str DEFAULT: ()

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()

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()

TransformationType #

Bases: Enum

Class that store the possible types of transformation functions.