forked from TrueCloudLab/frostfs-sdk-go
[#227] netmap: Remove unused aggregators and normalizers
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
723ba5ee45
commit
6796b4a29a
1 changed files with 0 additions and 56 deletions
|
@ -17,11 +17,6 @@ type (
|
|||
Normalize(w float64) float64
|
||||
}
|
||||
|
||||
meanSumAgg struct {
|
||||
sum float64
|
||||
count int
|
||||
}
|
||||
|
||||
meanAgg struct {
|
||||
mean float64
|
||||
count int
|
||||
|
@ -31,10 +26,6 @@ type (
|
|||
min float64
|
||||
}
|
||||
|
||||
maxAgg struct {
|
||||
max float64
|
||||
}
|
||||
|
||||
meanIQRAgg struct {
|
||||
k float64
|
||||
arr []float64
|
||||
|
@ -44,33 +35,21 @@ type (
|
|||
min float64
|
||||
}
|
||||
|
||||
maxNorm struct {
|
||||
max float64
|
||||
}
|
||||
|
||||
sigmoidNorm struct {
|
||||
scale float64
|
||||
}
|
||||
|
||||
constNorm struct {
|
||||
value float64
|
||||
}
|
||||
|
||||
// weightFunc calculates n's weight.
|
||||
weightFunc = func(NodeInfo) float64
|
||||
)
|
||||
|
||||
var (
|
||||
_ aggregator = (*meanSumAgg)(nil)
|
||||
_ aggregator = (*meanAgg)(nil)
|
||||
_ aggregator = (*minAgg)(nil)
|
||||
_ aggregator = (*maxAgg)(nil)
|
||||
_ aggregator = (*meanIQRAgg)(nil)
|
||||
|
||||
_ normalizer = (*reverseMinNorm)(nil)
|
||||
_ normalizer = (*maxNorm)(nil)
|
||||
_ normalizer = (*sigmoidNorm)(nil)
|
||||
_ normalizer = (*constNorm)(nil)
|
||||
)
|
||||
|
||||
// newWeightFunc returns weightFunc which multiplies normalized
|
||||
|
@ -112,19 +91,6 @@ func newSigmoidNorm(scale float64) normalizer {
|
|||
return &sigmoidNorm{scale: scale}
|
||||
}
|
||||
|
||||
func (a *meanSumAgg) Add(n float64) {
|
||||
a.sum += n
|
||||
a.count++
|
||||
}
|
||||
|
||||
func (a *meanSumAgg) Compute() float64 {
|
||||
if a.count == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return a.sum / float64(a.count)
|
||||
}
|
||||
|
||||
func (a *meanAgg) Add(n float64) {
|
||||
c := a.count + 1
|
||||
a.mean = a.mean*(float64(a.count)/float64(c)) + n/float64(c)
|
||||
|
@ -145,16 +111,6 @@ func (a *minAgg) Compute() float64 {
|
|||
return a.min
|
||||
}
|
||||
|
||||
func (a *maxAgg) Add(n float64) {
|
||||
if n > a.max {
|
||||
a.max = n
|
||||
}
|
||||
}
|
||||
|
||||
func (a *maxAgg) Compute() float64 {
|
||||
return a.max
|
||||
}
|
||||
|
||||
func (a *meanIQRAgg) Add(n float64) {
|
||||
a.arr = append(a.arr, n)
|
||||
}
|
||||
|
@ -200,14 +156,6 @@ func (r *reverseMinNorm) Normalize(w float64) float64 {
|
|||
return r.min / w
|
||||
}
|
||||
|
||||
func (r *maxNorm) Normalize(w float64) float64 {
|
||||
if r.max == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return w / r.max
|
||||
}
|
||||
|
||||
func (r *sigmoidNorm) Normalize(w float64) float64 {
|
||||
if r.scale == 0 {
|
||||
return 0
|
||||
|
@ -217,7 +165,3 @@ func (r *sigmoidNorm) Normalize(w float64) float64 {
|
|||
|
||||
return x / (1 + x)
|
||||
}
|
||||
|
||||
func (r *constNorm) Normalize(_ float64) float64 {
|
||||
return r.value
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue