Adaptive threshold tuning via AI