@@ -411,29 +411,9 @@ def get_historical_features(
411411 Examples:
412412 Retrieve historical features from a local offline store.
413413
414- >>> from feast import FeatureStore, Entity, FeatureView, Feature, ValueType, FileSource, RepoConfig
415- >>> from datetime import timedelta
414+ >>> from feast import FeatureStore, RepoConfig
416415 >>> import pandas as pd
417416 >>> fs = FeatureStore(config=RepoConfig(registry="feature_repo/data/registry.db", project="feature_repo", provider="local"))
418- >>> # Before retrieving historical features, we must register the appropriate entity and featureview.
419- >>> driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id")
420- >>> driver_hourly_stats = FileSource(
421- ... path="feature_repo/data/driver_stats.parquet",
422- ... event_timestamp_column="event_timestamp",
423- ... created_timestamp_column="created",
424- ... )
425- >>> driver_hourly_stats_view = FeatureView(
426- ... name="driver_hourly_stats",
427- ... entities=["driver_id"],
428- ... ttl=timedelta(seconds=86400 * 1),
429- ... features=[
430- ... Feature(name="conv_rate", dtype=ValueType.FLOAT),
431- ... Feature(name="acc_rate", dtype=ValueType.FLOAT),
432- ... Feature(name="avg_daily_trips", dtype=ValueType.INT64),
433- ... ],
434- ... batch_source=driver_hourly_stats,
435- ... )
436- >>> fs.apply([driver_hourly_stats_view, driver]) # register entity and feature view
437417 >>> entity_df = pd.DataFrame.from_dict(
438418 ... {
439419 ... "driver_id": [1001, 1002],
@@ -516,28 +496,9 @@ def materialize_incremental(
516496 Examples:
517497 Materialize all features into the online store up to 5 minutes ago.
518498
519- >>> from feast import FeatureStore, Entity, FeatureView, Feature, ValueType, FileSource, RepoConfig
520- >>> from datetime import timedelta
499+ >>> from feast import FeatureStore, RepoConfig
500+ >>> from datetime import datetime, timedelta
521501 >>> fs = FeatureStore(config=RepoConfig(registry="feature_repo/data/registry.db", project="feature_repo", provider="local"))
522- >>> # Before materializing, we must register the appropriate entity and featureview.
523- >>> driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id",)
524- >>> driver_hourly_stats = FileSource(
525- ... path="feature_repo/data/driver_stats.parquet",
526- ... event_timestamp_column="event_timestamp",
527- ... created_timestamp_column="created",
528- ... )
529- >>> driver_hourly_stats_view = FeatureView(
530- ... name="driver_hourly_stats",
531- ... entities=["driver_id"],
532- ... ttl=timedelta(seconds=86400 * 1),
533- ... features=[
534- ... Feature(name="conv_rate", dtype=ValueType.FLOAT),
535- ... Feature(name="acc_rate", dtype=ValueType.FLOAT),
536- ... Feature(name="avg_daily_trips", dtype=ValueType.INT64),
537- ... ],
538- ... batch_source=driver_hourly_stats,
539- ... )
540- >>> fs.apply([driver_hourly_stats_view, driver]) # register entity and feature view
541502 >>> fs.materialize_incremental(end_date=datetime.utcnow() - timedelta(minutes=5))
542503 Materializing...
543504 <BLANKLINE>
@@ -620,28 +581,9 @@ def materialize(
620581 Materialize all features into the online store over the interval
621582 from 3 hours ago to 10 minutes ago.
622583
623- >>> from feast import FeatureStore, Entity, FeatureView, Feature, ValueType, FileSource, RepoConfig
624- >>> from datetime import timedelta
584+ >>> from feast import FeatureStore, RepoConfig
585+ >>> from datetime import datetime, timedelta
625586 >>> fs = FeatureStore(config=RepoConfig(registry="feature_repo/data/registry.db", project="feature_repo", provider="local"))
626- >>> # Before materializing, we must register the appropriate entity and featureview.
627- >>> driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id",)
628- >>> driver_hourly_stats = FileSource(
629- ... path="feature_repo/data/driver_stats.parquet",
630- ... event_timestamp_column="event_timestamp",
631- ... created_timestamp_column="created",
632- ... )
633- >>> driver_hourly_stats_view = FeatureView(
634- ... name="driver_hourly_stats",
635- ... entities=["driver_id"],
636- ... ttl=timedelta(seconds=86400 * 1),
637- ... features=[
638- ... Feature(name="conv_rate", dtype=ValueType.FLOAT),
639- ... Feature(name="acc_rate", dtype=ValueType.FLOAT),
640- ... Feature(name="avg_daily_trips", dtype=ValueType.INT64),
641- ... ],
642- ... batch_source=driver_hourly_stats,
643- ... )
644- >>> fs.apply([driver_hourly_stats_view, driver]) # register entity and feature view
645587 >>> fs.materialize(
646588 ... start_date=datetime.utcnow() - timedelta(hours=3), end_date=datetime.utcnow() - timedelta(minutes=10)
647589 ... )
@@ -732,35 +674,8 @@ def get_online_features(
732674 Materialize all features into the online store over the interval
733675 from 3 hours ago to 10 minutes ago, and then retrieve these online features.
734676
735- >>> from feast import FeatureStore, Entity, FeatureView, Feature, ValueType, FileSource, RepoConfig
736- >>> from datetime import timedelta
737- >>> import pandas as pd
677+ >>> from feast import FeatureStore, RepoConfig
738678 >>> fs = FeatureStore(config=RepoConfig(registry="feature_repo/data/registry.db", project="feature_repo", provider="local"))
739- >>> # Before getting online features, we must register the appropriate entity and featureview and then materialize the features.
740- >>> driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id",)
741- >>> driver_hourly_stats = FileSource(
742- ... path="feature_repo/data/driver_stats.parquet",
743- ... event_timestamp_column="event_timestamp",
744- ... created_timestamp_column="created",
745- ... )
746- >>> driver_hourly_stats_view = FeatureView(
747- ... name="driver_hourly_stats",
748- ... entities=["driver_id"],
749- ... ttl=timedelta(seconds=86400 * 1),
750- ... features=[
751- ... Feature(name="conv_rate", dtype=ValueType.FLOAT),
752- ... Feature(name="acc_rate", dtype=ValueType.FLOAT),
753- ... Feature(name="avg_daily_trips", dtype=ValueType.INT64),
754- ... ],
755- ... batch_source=driver_hourly_stats,
756- ... )
757- >>> fs.apply([driver_hourly_stats_view, driver]) # register entity and feature view
758- >>> fs.materialize(
759- ... start_date=datetime.utcnow() - timedelta(hours=3), end_date=datetime.utcnow() - timedelta(minutes=10)
760- ... )
761- Materializing...
762- <BLANKLINE>
763- ...
764679 >>> online_response = fs.get_online_features(
765680 ... features=[
766681 ... "driver_hourly_stats:conv_rate",
0 commit comments