func updateMatch(lr *lr.LogisticRegression, records []creditRecord, protos []*hector.Sample, match [][]float64) { predictions := make([]float64, len(protos)) for i, proto := range protos { predictions[i] = lr.Predict(proto) } for borrower, dist := range match { r := records[borrower].returned nr := records[borrower].borrowed - r for iuser, gamma := range dist { match[borrower][iuser] = gamma * math.Exp(float64(r)*math.Log(1-predictions[iuser])+float64(nr)*math.Log(predictions[iuser])) } norm := sum(match[borrower]) for iuser, prob := range match[borrower] { match[borrower][iuser] = prob / norm } } }