Jelajahi Sumber

feat:去除无用的监控告警

zhaohaipeng 4 bulan lalu
induk
melakukan
fbf3a49b56
4 mengubah file dengan 76 tambahan dan 6 penghapusan
  1. 0 1
      script/alg_table_info.py
  2. 2 4
      script/eureka.py
  3. 0 1
      script/feature_spark_monitor.py
  4. 74 0
      script/t.py

+ 0 - 1
script/alg_table_info.py

@@ -19,7 +19,6 @@ table_list = [
     "alg_vid_feature_feed_province_exp_v2",
     "alg_vid_feature_feed_province_root_share_v2",
     "alg_vid_feature_feed_province_root_return_v2",
-    "alg_recsys_feature_cf_i2i_new_v2",
     "alg_cid_feature_basic_info",
     "alg_cid_feature_adver_action",
     "alg_cid_feature_cid_action",

+ 2 - 4
script/eureka.py

@@ -1,12 +1,10 @@
 from client import EurekaClient
 
-eureka_client = EurekaClient.EurekaClient("http://eureka-internal.piaoquantv.com/")
-
-# def _a():
+eureka_client = EurekaClient.EurekaClient("http://eureka-internal.piaoquantv.com")
 
 
 def _main():
-    app_id = "ad-engine"
+    app_id = "ad"
     app_info = eureka_client.get_apps_info(app_id)
     for datum in app_info['application']['instance']:
         if datum['status'] == 'OUT_OF_SERVICE':

+ 0 - 1
script/feature_spark_monitor.py

@@ -26,7 +26,6 @@ table_list = [
     "alg_vid_feature_feed_province_exp_v2",
     "alg_vid_feature_feed_province_root_share_v2",
     "alg_vid_feature_feed_province_root_return_v2",
-    "alg_recsys_feature_cf_i2i_new_v2",
     "alg_cid_feature_basic_info",
     "alg_cid_feature_adver_action",
     "alg_cid_feature_cid_action",

+ 74 - 0
script/t.py

@@ -0,0 +1,74 @@
+weight_v567 = {
+    "xgbNorScaleType": 1,
+    "xgbNorBias": -1.5147,
+    "xgbNorWeight": 2.277,
+    "xgbNorPowerWeight": 1.2216,
+    "xgbNorPowerExp": 1.32
+}
+weight_v564 = {
+    "fmRovBias": -0.0017,
+    "fmRovWeight": 1.331,
+    "fmRovSquareWeight": -6.4597,
+    "fmRovCubeWeight": 14.393,
+    "xgbNorScaleType": 1,
+    "xgbNorBias": -1.5147,
+    "xgbNorWeight": 2.277,
+    "xgbNorPowerWeight": 1.2216,
+    "xgbNorPowerExp": 1.32
+}
+score_map = {"fmRovOrigin": 0.27195945382118225, "NorXGBScore": 1.5618711709976196, "fmRov": 0.03600984021032825, "RovFMScore": 0.27195945382118225, "hasReturnRovScore": 2.442478, "vor": 8.230978}
+
+
+def rov_calibration(bias: float, weight: float, square_weight: float, cube_weight: float, score: float) -> float:
+    new_score = bias + weight * score
+    if abs(square_weight) > 1E-8:
+        new_score += square_weight * (score ** 2)
+    if abs(cube_weight) > 1E-8:
+        new_score += cube_weight * (score ** 3)
+    if new_score < 1E-8:
+        new_score = score
+    elif new_score > 0.9:
+        new_score = 0.9
+    return new_score
+
+
+def nor_calibration(scale_type: float, poly_bias: float, poly_weight: float,
+                    power_weight: float, power_exp: float, score: float) -> float:
+    if scale_type < 1:
+        return nor_poly_calibration(poly_bias, poly_weight, score)
+    else:
+        return nor_power_calibration(power_weight, power_exp, score)
+
+
+def nor_poly_calibration(bias: float, weight: float, score: float) -> float:
+    new_score = bias + weight * score
+    return max(new_score, 0)
+
+
+def nor_power_calibration(weight: float, exp: float, score: float) -> float:
+    new_score = weight * (score ** exp)
+    return min(new_score, 100)
+
+
+def _main():
+    fmRovBias = float(weight_v564["fmRovBias"])
+    fmRovWeight = float(weight_v564["fmRovWeight"])
+    fmRovSquareWeight = float(weight_v564["fmRovSquareWeight"])
+    fmRovCubeWeight = float(weight_v564["fmRovCubeWeight"])
+    xgbNorScaleType = float(weight_v564["xgbNorScaleType"])
+    xgbNorBias = float(weight_v564["xgbNorBias"])
+    xgbNorWeight = float(weight_v564["xgbNorWeight"])
+    xgbNorPowerWeight = float(weight_v564["xgbNorPowerWeight"])
+    xgbNorPowerExp = float(weight_v564["xgbNorPowerExp"])
+    fm_rov = float(score_map['fmRov'])
+    nor = float(score_map['NorXGBScore'])
+    vor = float(score_map['vor'])
+
+    # new_fm_rov = rov_calibration(fmRovBias, fmRovWeight, fmRovSquareWeight, fmRovCubeWeight, fm_rov)
+    new_fm_rov = fm_rov
+    new_nor = nor_calibration(xgbNorScaleType, xgbNorBias, xgbNorWeight, xgbNorPowerWeight, xgbNorPowerExp, nor)
+    print(new_fm_rov * (0.1 + new_nor) * (0.1 + vor))
+
+
+if __name__ == '__main__':
+    _main()