Skip to content

Commit 90e3b8b

Browse files
authored
fix scorecard model (#93)
1 parent 2aec0a1 commit 90e3b8b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sqlflow_models/score_card.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class ScoreCard(keras.Model):
2828
def __init__(self, feature_columns=None, pf_bin_size=5):
2929
super(ScoreCard, self).__init__(name='ScoreCard')
3030

31+
self._target_score = 600
3132
self._factor = 20/np.log(2)
3233
self._offset = 600 - 20*np.log(20) / np.log(2)
3334
self._bins = dict()
@@ -95,10 +96,11 @@ def sqlflow_train_loop(self, dataset, epochs=1, verbose=0):
9596
print("AUC: {}\n".format(auc_score))
9697

9798
# print the score card
98-
print("THE SCORE CARD:")
99+
print("TARGET SCORE: %d" % self._target_score)
99100
coe = lr.coef_
100101
for i, col_name in enumerate(x_df.columns):
101102
bin_cols = self._bins[col_name][0].index.to_list()
102103
for j, w in enumerate(self._bins[col_name][2]):
103104
print(col_name, bin_cols[j],
104-
round(coe[0][i] * w * self._factor, 0))
105+
round(coe[0][i] * w * self._factor +
106+
self._offset/self._pf_bin_size, 0))

0 commit comments

Comments
 (0)