made method get_likelihood and get_gradient