Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

score_utils.py 1.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  1. '''
  2. Some utility functions for combining scores for catboost clf and regr
  3. constants updated on
  4. 2019-12-22 13:39:40
  5. using FULL datasets
  6. Using 20 clf_wt and 80th percentile and above
  7. '''
  8. clf_wt = .2
  9. min_comb_score = 0.7867735270069716 #this version based off test_scores only
  10. # min_comb_16_score = 0.7874522706199785 #this version based off all_scores
  11. def scale_cb_regr_score(df):
  12. '''
  13. returns scaled score catboost_regr_scl. scaled to max/min of all historical
  14. predictions (all known loans, not just done, at time of model creation which as of 12.9.2019)
  15. is around 2.6 million loans.)
  16. '''
  17. cb_regr_max, cb_regr_min = 0.371186609868726, -1.138707443906103
  18. # print(df)
  19. # print(type(df))
  20. return (df['catboost_regr'] - cb_regr_min)/(cb_regr_max - cb_regr_min)
  21. def combined_score(clf_wt):
  22. '''
  23. returns a function that makes a linear combination of scores with passed
  24. clf_wt for the classifier
  25. '''
  26. def lin_comb_clf_regr(clf_score, regr_score, df):
  27. '''
  28. given colnames for clf and regr, makes a linear combination of
  29. the scores
  30. '''
  31. return df[clf_score]*clf_wt + (1-clf_wt)*df[regr_score]
  32. return lin_comb_clf_regr
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...