blocks-transformer/graph_post_processing.py
admin user 62dfadde20
All checks were successful
Build and Push Docker Image / test (push) Successful in 50s
Build and Push Docker Image / build_and_push (push) Successful in 2m21s
Advanced Graph Series model
2025-03-12 16:13:29 +00:00

32 lines
896 B
Python

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"
]
}