Example #1
0
//
// refillWithFP will copy the false-positive data in training set `tnset`
// and append it to `samples`.
//
func (crf *Runtime) refillWithFP(samples, tnset tabula.ClasetInterface,
	cm *classifier.CM,
) {
	// Get and sort FP.
	fpids := cm.FPIndices()
	sort.Ints(fpids)

	// Move FP samples from TN-set to training set samples.
	for _, i := range fpids {
		samples.PushRow(tnset.GetRow(i))
	}

	// Delete FP from training set.
	var row *tabula.Row
	c := 0
	for x, i := range fpids {
		row = tnset.DeleteRow(i - x)
		if row != nil {
			c++
		}
	}

	if DEBUG >= 1 {
		fmt.Println(tag, "# FP", len(fpids), "# refilled", c)
	}
}