|
@@ -1,6 +1,8 @@
|
|
|
#coding utf-8
|
|
|
import json
|
|
|
import math
|
|
|
+import time
|
|
|
+
|
|
|
def load_json(filename):
|
|
|
with open(filename, 'r') as fin:
|
|
|
json_data = json.load(fin)
|
|
@@ -22,3 +24,15 @@ def get_final_score(online_features, offline_score):
|
|
|
final_score = sigmoid(final_score)
|
|
|
return final_score, online_score
|
|
|
|
|
|
+if __name__ == '__main__':
|
|
|
+ app_type = 0
|
|
|
+ online_features = {
|
|
|
+ 'ctx_apptype': str(app_type),
|
|
|
+ 'ctx_week': time.strftime('%w', time.localtime()),
|
|
|
+ 'ctx_hour': time.strftime('%H', time.localtime()),
|
|
|
+ }
|
|
|
+ print(get_final_score(online_features, -1.0))
|
|
|
+ print(get_final_score(online_features, 0.0))
|
|
|
+ print(get_final_score({}, 0.0))
|
|
|
+
|
|
|
+
|