Define Feature and Labels with an ORM-style Syntax
Featureform has added a new way to define entities, features, and labels. This new API, which takes inspiration from Python ORMs, makes it easier for data scientists to define and manage their features and labels in code.
**Example**
python
transactions = postgres.register_table(
name="transactions",
table="Transactions", This is the table's name in Postgres
)
postgres.sql_transformation()
def average_user_transaction():
return "SELECT CustomerID as user_id, avg(TransactionAmount) " \
"as avg_transaction_amt from {{transactions.default}} GROUP BY user_id"
ff.entity
class User:
avg_transactions = ff.Feature(
average_user_transaction[["user_id", "avg_transaction_amt"]],
type=ff.Float32,
inference_store=redis,
)
fraudulent = ff.Label(
transactions[["customerid", "isfraud"]], variant="quickstart", type=ff.Bool
)
ff.register_training_set(
"fraud_training",
label="fraudulent",
features=["avg_transactions"],
)
You can read more in the [docs](https://docs.featureform.com/quickstart-docker).
Compute features at serving time with on-demand features
A highly requested feature was to feature-ize incoming data at serving time. For example, you may have an on-demand feature that turns a user comment into an embedding, or one that processes an incoming image.
**On-demand feature that turns a comment to an embedding at serving time**
python
ff.ondemand_feature
def text_to_embedding(serving_client, params, entities):
return bert_transform(params[“comment”])
You can learn more in the [docs](https://docs.featureform.com/getting-started/serving-for-inference-and-training#on-demand-features)
Attach tags & user-defined values to Featureform resources like transformations, features, and labels.
All features, labels, transformations, and training sets now have a `tags` and `properties` argument. `properties` is a dict and `tags` is a list.
python
client.register_training_set(“CustomerLTV_Training”, “default”, label=”ltv”, features=[“f1”, “f2”], tags=[“revenue”], properties={“visibility”: “internal”})
You can read more in the [docs](https://docs.featureform.com/getting-started/metadata-tags).
Transformation and training set caching in local mode.
Featureform has a [local mode](https://docs.featureform.com/quickstart-local) that allows users to define, manage, and serve their features when working locally off their laptop. It doesn’t require anything to be deployed. It would historically re-generate training sets and features on each run, but with 0.7, we cache results by default to decrease iteration time.
A cleaner (and more colorful) CLI flow!

**Full Changelog**: https://github.com/featureform/featureform/compare/v0.6.4...v0.7.0