<jupyter_start><jupyter_text>Feast Quick StartThis is a quick example to demonstrate:- Register a feature set on Feast- Ingest features into Feast- Retrieve the ingested features from Feast- Update a feature<jupyter_code>import feast
import numpy as np
import pandas as pd
from datetime import datetime
from feast.serving.ServingService_pb2 import GetOnlineFeaturesRequest
from feast.types.Value_pb2 import Value as Value
from feast.client import Client
from feast.feature_set import FeatureSet<jupyter_output><empty_output><jupyter_text>First, instantiate the client.Feast endpoints can be set via the following environmental variables: `FEAST_CORE_URL`, `FEAST_SERVING_URL`.Alternatively, they can also be passed in explicitly as follows:    `client = feast.Client(core_url=core:6565, serving_url=online-serving:6566)`<jupyter_code>client = feast.Client()<jupyter_output><empty_output><jupyter_text>Register a feature setLet's create and register our first feature set. Below is an example of a basic customer transactions feature set that has been exported to YAML:```name: customer_transactionskind: feature_setentities:- name: customer_id  valueType: INT64features:- name: daily_transactions  valueType: FLOAT- name: total_transactions  valueType: FLOATmaxAge: 3600s    ```<jupyter_code>cust_trans_fs = FeatureSet.from_yaml("../features/cust_trans_fs.yaml")
client.apply(cust_trans_fs)<jupyter_output>Feature set updated/created: "customer_transactions:1".<jupyter_text>Ingest features into FeastThe dataframe below contains the features and entities of the above feature set.<jupyter_code>offset = 10000
nr_of_customers = 5
customer_df = pd.DataFrame(
    {
        "datetime": [datetime.utcnow() for _ in range(nr_of_customers)],
        "customer_id": [offset + inc for inc in range(nr_of_customers)],
        "daily_transactions": [np.random.uniform(0, 10) for _ in range(nr_of_customers)],
        "total_transactions": [np.random.uniform(100, 200) for _ in range(nr_of_customers)],
    }
)
customer_df
client.ingest(cust_trans_fs, dataframe=customer_df)<jupyter_output>0%|          | 0/5 [00:00<?, ?rows/s]8rows/s]<jupyter_text>Retrieve the ingested features from FeastOnce the features are ingested, they can be retrieved from the Feast store for model training or prediction purposes.<jupyter_code>client.get_online_features(
    entity_rows=[
        GetOnlineFeaturesRequest.EntityRow(
            fields={
                "customer_id": Value(
                    int64_val=10001
                )
            }
        )
    ],
    feature_ids=[
        "customer_transactions:1:daily_transactions",
        "customer_transactions:1:total_transactions",
    ],
)<jupyter_output><empty_output><jupyter_text>Update a featureWe can also update feature set which has been ingested.<jupyter_code>cust_trans_fs_updated = FeatureSet.from_yaml("../features/cust_trans_fs_updated.yaml")
client.apply(cust_trans_fs_updated)
discounts = [np.random.uniform(0, 10) for _ in range(nr_of_customers)]
customer_df_updated = customer_df.assign(discounts=discounts)
customer_df_updated
client.ingest(cust_trans_fs_updated, dataframe=customer_df_updated)
client.get_online_features(
    entity_rows=[
        GetOnlineFeaturesRequest.EntityRow(
            fields={
                "customer_id": Value(
                    int64_val=10001
                )
            }
        )
    ],
    feature_ids=[
        "customer_transactions:2:daily_transactions",
        "customer_transactions:2:total_transactions",
        "customer_transactions:2:discounts",
    ],
)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08595271210013908, 'fraction_numerical': 0.017246175243393603, 'mean_word_length': 4.523809523809524, 'pattern_counts': {'":': 6, '<': 24, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '267852', 'license': 'Apache-2.0', 'n_tokens_mistral': 1158, 'n_tokens_neox': 1083, 'n_words': 253, 'path': 'infra/docker-compose/jupyter/notebooks/feast-quickstart.ipynb', 'repo_name': 'lgvital/feast2', 'size': '3595'}