extract_risk function

extract the risk value when knowing the weights