lir.transform.save_features module

class lir.transform.save_features.SaveFeatureTransformer(save_as: str)[source]

Bases: Transformer

Transformer to save the features of the instances in a new field.

The idea of this transformer is to capture the features of the instances at a specific point in the pipeline, and save them in a new field in the instance data. This can be useful for later analysis, plotting, or debugging.

Parameters:

save_as (str) – The name of the field to save the features in.

apply(instances: InstanceData) InstanceData[source]

Save the features of the instances in a new field, and return the instances.

Parameters:

instances (InstanceData) – The instances to transform.

Returns:

The instances with the saved features.

Return type:

InstanceData

fit(instances: InstanceData) Self[source]

Fit the transformer to the instances. This transformer does not require fitting, so this method returns self.

Parameters:

instances (InstanceData) – The instances to fit.

Returns:

The fitted transformer.

Return type:

SaveFeatureTransformer