blocks-transformer/post_processing.py
admin user ead9a776da
All checks were successful
Build and Push Docker Image / test (push) Successful in 55s
Build and Push Docker Image / build_and_push (push) Successful in 3m21s
Advanced M series V1 model block
2025-03-12 16:12:18 +00:00

26 lines
777 B
Python

import logging
import numpy as np
# Configure logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s - %(message)s",
)
logger = logging.getLogger(__name__)
def post_processing(df):
try:
df['hd_score_m1'] = np.round(
np.minimum(df['prediction'] * 100 + 0.00001, 1) * 85 +
np.maximum(np.log2(df['prediction'] * 100 + 0.000001) * 185, 0),
0
)
logging.info(f"hd_score_m1 calculated: {df['hd_score_m1'].iloc[0]}")
except Exception as e:
logging.error(f"Error processing hd_score_m1 calculations: {e}")
return df[['application_key', 'application_timestamp', 'deviceid', 'fuzzydeviceid', 'application_email_address', 'hd_score_m1']].iloc[0].to_dict()