// // Initialize will check crf inputs and set it to default values if its // invalid. // func (crf *Runtime) Initialize(samples tabula.ClasetInterface) error { if crf.NStage <= 0 { crf.NStage = DefStage } if crf.TPRate <= 0 || crf.TPRate >= 1 { crf.TPRate = DefTPRate } if crf.TNRate <= 0 || crf.TNRate >= 1 { crf.TNRate = DefTNRate } if crf.NTree <= 0 { crf.NTree = DefNumTree } if crf.PercentBoot <= 0 { crf.PercentBoot = DefPercentBoot } if crf.NRandomFeature <= 0 { // Set default value to square-root of features. ncol := samples.GetNColumn() - 1 crf.NRandomFeature = int(math.Sqrt(float64(ncol))) } if crf.PerfFile == "" { crf.PerfFile = DefPerfFile } if crf.StatFile == "" { crf.StatFile = DefStatFile } crf.tnset = samples.Clone().(*tabula.Claset) return crf.Runtime.Initialize() }