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()