diff --git a/metrics/pairwise/cranberra.go b/metrics/pairwise/cranberra.go index 8a972cd..5f673bb 100644 --- a/metrics/pairwise/cranberra.go +++ b/metrics/pairwise/cranberra.go @@ -15,9 +15,8 @@ func NewCranberra() *Cranberra { func cranberraDistanceStep(num float64, denom float64) float64 { if num == .0 && denom == .0 { return .0 - } else { - return num / denom } + return num / denom } func (self *Cranberra) Distance(vectorX *mat64.Dense, vectorY *mat64.Dense) float64 { diff --git a/trees/id3.go b/trees/id3.go index f7ceab0..08dd5d0 100644 --- a/trees/id3.go +++ b/trees/id3.go @@ -156,18 +156,18 @@ func (d *DecisionTreeNode) Prune(using *base.Instances) { // If you're a leaf, you're already pruned if d.Children == nil { return - } else { - if d.SplitAttr == nil { - return - } - // Recursively prune children of this node - sub := using.DecomposeOnAttributeValues(d.SplitAttr) - for k := range d.Children { - if sub[k] == nil { - continue - } - d.Children[k].Prune(sub[k]) + } + if d.SplitAttr == nil { + return + } + + // Recursively prune children of this node + sub := using.DecomposeOnAttributeValues(d.SplitAttr) + for k := range d.Children { + if sub[k] == nil { + continue } + d.Children[k].Prune(sub[k]) } // Get a baseline accuracy