diff options
| author | Shulhan <ms@kilabit.info> | 2025-01-23 03:40:50 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-01-23 03:41:10 +0700 |
| commit | 2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch) | |
| tree | cce840739c7f59893c3a6a65a1600f9f857c484e /lib/mining/classifier/stats_interface.go | |
| parent | 605d847b236dde031a2e387e74298d66a27b5e0a (diff) | |
| download | pakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz | |
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/mining/classifier/stats_interface.go')
| -rw-r--r-- | lib/mining/classifier/stats_interface.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/mining/classifier/stats_interface.go b/lib/mining/classifier/stats_interface.go index f780d58b..38599d23 100644 --- a/lib/mining/classifier/stats_interface.go +++ b/lib/mining/classifier/stats_interface.go @@ -1,6 +1,6 @@ -// Copyright 2016 Mhd Sulhan <ms@kilabit.info>. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +// SPDX-FileCopyrightText: 2016 M. Shulhan <ms@kilabit.info> +// +// SPDX-License-Identifier: BSD-3-Clause package classifier @@ -15,7 +15,7 @@ func ComputeFMeasures(precisions, recalls []float64) (fmeasures []float64) { minlen = recallslen } - for x := 0; x < minlen; x++ { + for x := range minlen { f := 2 / ((1 / precisions[x]) + (1 / recalls[x])) fmeasures = append(fmeasures, f) } @@ -38,7 +38,7 @@ func ComputeAccuracies(tp, fp, tn, fn []int64) (accuracies []float64) { minlen = len(fn) } - for x := 0; x < minlen; x++ { + for x := range minlen { acc := float64(tp[x]+tn[x]) / float64(tp[x]+fp[x]+tn[x]+fn[x]) accuracies = append(accuracies, acc) @@ -55,7 +55,7 @@ func ComputeElapsedTimes(start, end []int64) (elaps []int64) { minlen = len(end) } - for x := 0; x < minlen; x++ { + for x := range minlen { elaps = append(elaps, end[x]-start[x]) } return |
