compute_risk function

Compute risk value