An On-Demand Feature represents a Feature resource, rather than a Transformation. It’s possible to string together on-demand features; however, On-Demand Features are solely intended for post-processing data during request times.

To define an on-demand feature, employ a decorator that comes with three parameters: a Featureform client to retrieve other necessary features, an entity dictionary serving the same purpose, and an args parameter containing the data for request processing.

import featureform as ff

@ff.ondemand_feature()
def scale_value(client, params, entities):
    return params[0] / 10

client.apply()

Once applied, this on-demand feature can be served using the following code snippet:

client.features([scale_value], params=[100])

This mechanism enables you to generate features on data that’s available in request time. It gives Featureform’s API the flexibility to be used to calculate features in all possible contexts.