[FIX] Add leave-one-out in cost function

The computation of cost function is now more robust due to the use of
leave-one-out method.