import logging import math # Configure logging logging.basicConfig( level=logging.INFO, format="%(asctime)s [%(levelname)s] %(name)s - %(message)s", ) logger = logging.getLogger(__name__) def post_processing(data): try: prediction = data.get("prediction", 0) score_g1 = round( min(prediction * 100 + 0.00001, 1) * 89 + max(math.log2(prediction * 100 + 0.000001) * 193, 0), 0 ) data["hd_score_g1"] = score_g1 logger.info(f"score_g1 calculated: {score_g1}") except Exception as e: logger.error(f"Error processing score_g1 calculations: {e}") return { key: data.get(key, None) for key in [ "hd_score_m1", "hd_score_g1", "cluster_size_users_v2", "target_connected_30_sum", "email_cnt", "rejected_app_count", "app_dt_day_cnt", "hd_score_iso_m2" ] }