Probabilistic-based approach to optimal filtering