26 lines
777 B
Python
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()
|