feat: initial release
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package stats
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sourcedock.dev/petrbalvin/tensor/internal/core"
|
||||
)
|
||||
|
||||
// BenchmarkQuantileRegressionFit measures the interior-point quantile
|
||||
// fit: the barrier Newton systems, the fraction-to-the-boundary walk
|
||||
// and the primal recovery, at a size where the per-iteration system
|
||||
// build is a visible share of the run.
|
||||
func BenchmarkQuantileRegressionFit(b *testing.B) {
|
||||
const n, p = 400, 8
|
||||
x, vals := regDesign(b, n, p, 0x5eed0041)
|
||||
src := &randSource{state: 0x5eed0042}
|
||||
yv := make([]float64, n)
|
||||
for i := range n {
|
||||
eta := 0.5
|
||||
for c := range p {
|
||||
eta += 0.25 * vals[i*p+c]
|
||||
}
|
||||
yv[i] = eta + (src.next()-0.5)*0.5
|
||||
}
|
||||
y, err := core.FromFloats(yv, n)
|
||||
if err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
b.ReportAllocs()
|
||||
for b.Loop() {
|
||||
if _, err := QuantileRegression(x, y, 0.5); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user