Robust state estimation is a fundamental research topic in robotics. Existing approaches like robust kernels combined with iteratively re-weighted least squares (IRLS) often require heuristic parameter selection and extensive fine-tuning. In this manuscript, we propose a novel method that optimizes kernels while preserving the advantages of existing techniques. By introducing a probabilistic interpretation of weights and residuals, our approach enables automatic parameter selection. Applied to iterative closest point (ICP) and bundle adjustment (BA), experimental results demonstrate improved convergence and robustness compared to traditional methods, eliminating the need for time-consuming parameter tuning and offering a practical solution for robust state estimation.