func (smote *Runtime) populate(instance *tabula.Row, neighbors knn.Neighbors) {
	lenAttr := len(*instance)
	for x := 0; x < smote.NSynthetic; x++ {
		n := rand.Intn(neighbors.Len())
		sample := neighbors.Row(n)
		newSynt := make(tabula.Row, lenAttr)
		for attr, sr := range *sample {
			if attr == smote.ClassIndex {
				continue
			}
			ir := (*instance)[attr]
			iv := ir.Float()
			sv := sr.Float()
			dif := sv - iv
			gap := rand.Float64()
			newAttr := iv + (gap * dif)
			record := &tabula.Record{}
			record.SetFloat(newAttr)
			newSynt[attr] = record
		}
		newSynt[smote.ClassIndex] = (*instance)[smote.ClassIndex]
		smote.Synthetics.PushRow(&newSynt)
	}
}
populate will generate new synthetic sample using nearest neighbors.
package smote
import (
	"fmt"
	"math/rand"
	"time"
	"github.com/shuLhan/share/lib/mining/knn"
	"github.com/shuLhan/share/lib/mining/resampling"
	"github.com/shuLhan/share/lib/tabula"
)
type Runtime struct {
	knn.Runtime
	PercentOver int `json:"PercentOver"`
	SyntheticFile string `json:"SyntheticFile"`
	NSynthetic int
	Synthetics tabula.Dataset
}
func New(percentOver, k, classIndex int) (smoteRun *Runtime) {
	smoteRun = &Runtime{
		Runtime: knn.Runtime{
			DistanceMethod: knn.TEuclidianDistance,
			ClassIndex:     classIndex,
			K:              k,
		},
		PercentOver: percentOver,
	}
	return
}
func (smote *Runtime) Init() {
	rand.Seed(time.Now().UnixNano())
	if smote.K <= 0 {
		smote.K = resampling.DefaultK
	}
	if smote.PercentOver <= 0 {
		smote.PercentOver = resampling.DefaultPercentOver
	}
}
func (smote *Runtime) GetSynthetics() tabula.DatasetInterface {
	return &smote.Synthetics
}