update pattern scoring function