示例#1
0
func (this *Hypothesis) part_DiffH1Ys(i0, i1 int, Ts *TrainingSet, Ret *Matrix.Matrix, RetT *Matrix.Matrix, done chan<- bool) {
	di := i1 - i0

	if di >= THRESHOLD && runtime.NumGoroutine() < maxGoRoutines {
		done2 := make(chan bool, THRESHOLD)

		mi := i0 + di/2
		go this.part_DiffH1Ys(i0, mi, Ts, Ret, RetT, done2)
		go this.part_DiffH1Ys(mi, i1, Ts, Ret, RetT, done2)
		<-done2
		<-done2
	} else {
		for i := i0; i <= i1; i++ {
			xi := Ts.Xs.GetRow(i)

			Thi := Matrix.Product(xi, this.ThetaParameters.Transpose())
			temp := this.H(Thi.GetValue(1, 1)) - Ts.Y.GetValue(1, i)
			Ret.SetValue(i, 1, temp)
			RetT.SetValue(1, i, temp)
		}
	}
	done <- true
}