Skip to content

Serving

Features

Returns the feature values for the specified entities.

Examples:

    client = ff.Client()
    fpf = client.features([("avg_transactions", "quickstart")], {"user": "C1410926"})
    # Run features through model

Parameters:

Name Type Description Default
features (list[str, str], list[str])

List of Name Variant Tuples

required
entities dict

Dictionary of entity name/value pairs

required

Returns:

Name Type Description
features Array

An Numpy array of feature values in the order given by the inputs

Training Sets

Return an iterator that iterates through the specified training set.

Examples:

    client = ff.Client()
    dataset = client.training_set("fraud_training", "quickstart")
    training_dataset = dataset.repeat(10).shuffle(1000).batch(8)
    for feature_batch in training_dataset:
        # Train model

Parameters:

Name Type Description Default
name str

Name of training set to be retrieved

required
variant str

Variant of training set to be retrieved

''

Returns:

Name Type Description
training_set Dataset

A training set iterator

Sources

Return a dataframe from a registered source or transformation

Example:

definitions.py
transactions_df = client.dataframe("transactions", "quickstart")

avg_user_transaction_df = transactions_df.groupby("CustomerID")["TransactionAmount"].mean()

Parameters:

Name Type Description Default
source Union[SourceRegistrar, LocalSource, SubscriptableTransformation, str]

The source or transformation to compute the dataframe from

required
variant str

The source variant; can't be None if source is a string

None
limit int

The maximum number of records to return; defaults to NO_RECORD_LIMIT

NO_RECORD_LIMIT
asynchronous bool

Flag to determine whether the client should wait for resources to be in either a READY or FAILED state before returning. Defaults to False to ensure that newly registered resources are in a READY state prior to serving them as dataframes.

False

Returns:

Name Type Description
df DataFrame

The dataframe computed from the source or transformation

Nearest Neighbors

Query the K nearest neighbors of a provider vector in the index of a registered feature variant

Example:

definitions.py
# Get the 5 nearest neighbors of the vector [0.1, 0.2, 0.3] in the index of the feature "my_feature" with variant "my_variant"
nearest_neighbors = client.nearest("my_feature", "my_variant", [0.1, 0.2, 0.3], 5)
print(nearest_neighbors) # prints a list of entities (e.g. ["entity1", "entity2", "entity3", "entity4", "entity5"])

Parameters:

Name Type Description Default
feature Union[FeatureColumnResource, tuple(str, str)]

Feature object or tuple of Feature name and variant

required
vector List[float]

Query vector

required
k int

Number of nearest neighbors to return

required