1
1
from datetime import timedelta
2
2
3
3
from feast import (
4
- Bool ,
5
4
Entity ,
6
5
FeatureService ,
7
6
FeatureView ,
8
7
Field ,
9
8
FileSource ,
10
- Int64 ,
11
- String ,
12
9
ValueType ,
13
10
)
14
11
from feast .data_source import RequestSource
15
12
from feast .request_feature_view import RequestFeatureView
16
13
from feast .on_demand_feature_view import on_demand_feature_view
17
- from feast .field import Field
14
+ from feast .types import Bool , Int64 , String
18
15
import pandas as pd
19
16
20
17
zipcode = Entity (
21
18
name = "zipcode" ,
22
19
value_type = ValueType .INT64 ,
23
20
description = "A zipcode" ,
24
- labels = {
"owner" :
"[email protected] " ,
"team" :
"hack week" ,},
21
+ tags = {
"owner" :
"[email protected] " ,
"team" :
"hack week" ,},
25
22
)
26
23
27
24
zipcode_source = FileSource (
43
40
Field (name = "population" , dtype = Int64 ),
44
41
Field (name = "total_wages" , dtype = Int64 ),
45
42
],
46
- batch_source = zipcode_source ,
43
+ source = zipcode_source ,
47
44
tags = {
48
45
"date_added" : "2022-02-7" ,
49
46
"experiments" : "experiment-A,experiment-B,experiment-C" ,
64
61
Field (name = "population" , dtype = Int64 ),
65
62
Field (name = "total_wages" , dtype = Int64 ),
66
63
],
67
- batch_source = zipcode_source ,
64
+ source = zipcode_source ,
68
65
tags = {
69
66
"date_added" : "2022-02-7" ,
70
67
"experiments" : "experiment-A,experiment-B,experiment-C" ,
81
78
Field (name = "tax_returns_filed" , dtype = Int64 ),
82
79
Field (name = "total_wages" , dtype = Int64 ),
83
80
],
84
- batch_source = zipcode_source ,
81
+ source = zipcode_source ,
85
82
tags = {
86
83
"date_added" : "2022-02-7" ,
87
84
"experiments" : "experiment-A,experiment-B,experiment-C" ,
94
91
name = "dob_ssn" ,
95
92
value_type = ValueType .STRING ,
96
93
description = "Date of birth and last four digits of social security number" ,
97
- labels = {
"owner" :
"[email protected] " ,
"team" :
"hack week" ,},
94
+ tags = {
"owner" :
"[email protected] " ,
"team" :
"hack week" ,},
98
95
)
99
96
100
97
credit_history_source = FileSource (
119
116
Field (name = "missed_payments_6m" , dtype = Int64 ),
120
117
Field (name = "bankruptcies" , dtype = Int64 ),
121
118
],
122
- batch_source = credit_history_source ,
119
+ source = credit_history_source ,
123
120
tags = {
124
121
"date_added" : "2022-02-6" ,
125
122
"experiments" : "experiment-A" ,
@@ -152,16 +149,10 @@ def transaction_gt_last_credit_card_due(inputs: pd.DataFrame) -> pd.DataFrame:
152
149
)
153
150
return df
154
151
155
-
156
- # Define request feature view
157
- transaction_request_fv = RequestFeatureView (
158
- name = "transaction_request_fv" , request_data_source = input_request ,
159
- )
160
-
161
152
model_v1 = FeatureService (
162
153
name = "credit_score_v1" ,
163
154
features = [
164
- credit_history [["mortgage_due" , " credit_card_due" , "missed_payments_1y" ]],
155
+ credit_history [["credit_card_due" , "missed_payments_1y" ]],
165
156
zipcode_features ,
166
157
],
167
158
tags = {
"owner" :
"[email protected] " ,
"stage" :
"staging" },
@@ -173,7 +164,6 @@ def transaction_gt_last_credit_card_due(inputs: pd.DataFrame) -> pd.DataFrame:
173
164
features = [
174
165
credit_history [["mortgage_due" , "credit_card_due" , "missed_payments_1y" ]],
175
166
zipcode_features ,
176
- transaction_request_fv ,
177
167
],
178
168
tags = {
"owner" :
"[email protected] " ,
"stage" :
"prod" },
179
169
description = "Credit scoring model" ,
0 commit comments