Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions ui/feature_repo/features.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
from datetime import timedelta

from feast import (
Entity,
FeatureService,
FeatureView,
Field,
FileSource,
ValueType,
)
import pandas as pd

from feast import Entity, FeatureService, FeatureView, Field, FileSource, ValueType
from feast.data_source import RequestSource
from feast.request_feature_view import RequestFeatureView
from feast.on_demand_feature_view import on_demand_feature_view
from feast.types import Bool, Int64, String
import pandas as pd

zipcode = Entity(
name="zipcode",
Expand Down Expand Up @@ -128,19 +121,14 @@
# Define a request data source which encodes features / information only
# available at request time (e.g. part of the user initiated HTTP request)
input_request = RequestSource(
name="transaction",
schema=[
Field(name="transaction_amt", dtype=Int64),
],
name="transaction", schema=[Field(name="transaction_amt", dtype=Int64),],
)

# Define an on demand feature view which can generate new features based on
# existing feature views and RequestSource features
@on_demand_feature_view(
sources=[credit_history, input_request],
schema=[
Field(name="transaction_gt_last_credit_card_due", dtype=Bool),
],
schema=[Field(name="transaction_gt_last_credit_card_due", dtype=Bool),],
)
def transaction_gt_last_credit_card_due(inputs: pd.DataFrame) -> pd.DataFrame:
df = pd.DataFrame()
Expand All @@ -149,6 +137,7 @@ def transaction_gt_last_credit_card_due(inputs: pd.DataFrame) -> pd.DataFrame:
)
return df


model_v1 = FeatureService(
name="credit_score_v1",
features=[
Expand Down
9 changes: 4 additions & 5 deletions ui/feature_repo/test_get_features.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import pandas as pd
from feast import FeatureStore
from feast.infra.offline_stores.file import SavedDatasetFileStorage

from feast.dqm.profilers.ge_profiler import ge_profiler

from great_expectations.core.expectation_suite import ExpectationSuite
from great_expectations.dataset import PandasDataset

from feast import FeatureStore
from feast.dqm.profilers.ge_profiler import ge_profiler
from feast.infra.offline_stores.file import SavedDatasetFileStorage

DELTA = 0.1 # controlling allowed window in fraction of the value on scale [0, 1]
# Note: the GE integration allows asserting differences between datasets. The "ds" below is the reference dataset to check and this generates the expectation suite which can be used against future datasets.
# It's used via ge.validate(new_dataset, ExpectationSuite)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/parsers/feastEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FEAST_FEATURE_VALUE_TYPES } from "./types";
const FeastEntitySchema = z.object({
spec: z.object({
name: z.string(),
valueType: z.nativeEnum(FEAST_FEATURE_VALUE_TYPES),
valueType: z.nativeEnum(FEAST_FEATURE_VALUE_TYPES).optional(),
joinKey: z.string(),
description: z.string().optional(),
labels: z.record(z.string()).optional(),
Expand Down