diff options
| author | Shulhan <ms@kilabit.info> | 2024-01-24 02:24:36 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-01-24 02:24:58 +0700 |
| commit | e0bb07c340e5d0821840b4f09655dc9653dc3105 (patch) | |
| tree | f392d8d86b709293b694c1b54e5a5e499d365f59 /lib/mining/classifier/rf | |
| parent | b8a84637a476a05097d98a87e5c6af59b0d3e413 (diff) | |
| download | pakakeh.go-e0bb07c340e5d0821840b4f09655dc9653dc3105.tar.xz | |
all: fix the warnings from linter revive
This rename all variable "Ids" into "ListID".
Diffstat (limited to 'lib/mining/classifier/rf')
| -rw-r--r-- | lib/mining/classifier/rf/rf.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/mining/classifier/rf/rf.go b/lib/mining/classifier/rf/rf.go index f725fff1..6a1ae6fd 100644 --- a/lib/mining/classifier/rf/rf.go +++ b/lib/mining/classifier/rf/rf.go @@ -228,9 +228,9 @@ func (forest *Runtime) GrowTree(samples tabula.ClasetInterface) ( // ClassifySet given a samples predict their class by running each sample in // forest, and return their class prediction with confusion matrix. -// `samples` is the sample that will be predicted, `sampleIds` is the index of +// `samples` is the sample that will be predicted, `sampleListID` is the index of // samples. -// If `sampleIds` is not nil, then sample index will be checked in each tree, +// If `sampleListID` is not nil, then sample index will be checked in each tree, // if the sample is used for training, their vote is not counted. // // Algorithm, @@ -242,17 +242,17 @@ func (forest *Runtime) GrowTree(samples tabula.ClasetInterface) ( // (1.3) compute and save the actual class probabilities. // (2) Compute confusion matrix from predictions. // (3) Compute stat from confusion matrix. -// (4) Write the stat to file only if sampleIds is empty, which mean its run +// (4) Write the stat to file only if sampleListID is empty, which mean its run // not from OOB set. func (forest *Runtime) ClassifySet(samples tabula.ClasetInterface, - sampleIds []int, + sampleListID []int, ) ( predicts []string, cm *classifier.CM, probs []float64, ) { stat := classifier.Stat{} stat.Start() - if len(sampleIds) == 0 { + if len(sampleListID) == 0 { fmt.Println(tag, "Classify set:", samples) fmt.Println(tag, "Classify set sample (one row):", samples.GetRow(0)) @@ -267,8 +267,8 @@ func (forest *Runtime) ClassifySet(samples tabula.ClasetInterface, rows := samples.GetRows() for x, row := range *rows { // (1.1) - if len(sampleIds) > 0 { - sampleIdx = sampleIds[x] + if len(sampleListID) > 0 { + sampleIdx = sampleListID[x] } votes := forest.Votes(row, sampleIdx) @@ -286,13 +286,13 @@ func (forest *Runtime) ClassifySet(samples tabula.ClasetInterface, } // (2) - cm = forest.ComputeCM(sampleIds, vs, actuals, predicts) + cm = forest.ComputeCM(sampleListID, vs, actuals, predicts) // (3) forest.ComputeStatFromCM(&stat, cm) stat.End() - if len(sampleIds) == 0 { + if len(sampleListID) == 0 { fmt.Println(tag, "CM:", cm) fmt.Println(tag, "Classifying stat:", stat) _ = stat.Write(forest.StatFile) |
