From 2a0694d2fa577574b505c4635eb8a824eaf88ddc Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 23 Jan 2025 03:40:50 +0700 Subject: all: use for-range with numeric Go 1.22 now support for-range on numeric value. --- lib/mining/classifier/stats_interface.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/mining/classifier/stats_interface.go') 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 . 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 +// +// 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 -- cgit v1.3-5-g9baa