Skip to content

Commit 7cd55dc

Browse files
committed
Add logging to demo scripts
This adds print statements to be able to better show functionality of the feature store in the example
1 parent 6f074a6 commit 7cd55dc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

credit_model.py

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ def predict(self, request):
101101
features = request.copy()
102102
features.update(feature_vector)
103103
features_df = pd.DataFrame.from_dict(features)
104+
pd.set_option('display.max_columns', 15)
105+
print('Data returned from online store for request:')
106+
print(features_df[['dob_ssn', 'total_debt_due', 'credit_card_due', 'mortgage_due', 'student_loan_due', 'vehicle_loan_due', 'loan_amnt']])
104107

105108
# Apply ordinal encoding to categorical features
106109
self._apply_ordinal_encoding(features_df)

run.py

+5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010

1111
# Train model (using Postgres for zipcode and credit history features)
1212
if not model.is_model_trained():
13+
print('Starting model training...')
1314
model.train(loans)
15+
print('Model has been trained successfully')
16+
else:
17+
print('Model was already trained in a previous run')
1418

1519
# Make online prediction (using Redis for retrieving online features)
1620
loan_request = {
@@ -25,6 +29,7 @@
2529
"loan_int_rate": [16.02],
2630
}
2731

32+
print(f'Submitting a prediction to the model with data {loan_request}')
2833
result = model.predict(loan_request)
2934

3035
if result == 0:

0 commit comments

Comments
 (0)