refactor: change project structure and package name
This commit is contained in:
parent
c1468e8ae4
commit
ad10e9a062
163 changed files with 104 additions and 135 deletions
35
pkg/chart/polynomial_regression_test.go
Normal file
35
pkg/chart/polynomial_regression_test.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package chart
|
||||
|
||||
import (
|
||||
"github.com/d-Rickyy-b/go-chart-x/v2/pkg/matrix"
|
||||
"testing"
|
||||
|
||||
"github.com/d-Rickyy-b/go-chart-x/v2/testutil"
|
||||
)
|
||||
|
||||
func TestPolynomialRegression(t *testing.T) {
|
||||
// replaced new assertions helper
|
||||
|
||||
var xv []float64
|
||||
var yv []float64
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
xv = append(xv, float64(i))
|
||||
yv = append(yv, float64(i*i))
|
||||
}
|
||||
|
||||
values := ContinuousSeries{
|
||||
XValues: xv,
|
||||
YValues: yv,
|
||||
}
|
||||
|
||||
poly := &PolynomialRegressionSeries{
|
||||
InnerSeries: values,
|
||||
Degree: 2,
|
||||
}
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
_, y := poly.GetValues(i)
|
||||
testutil.AssertInDelta(t, float64(i*i), y, matrix.DefaultEpsilon)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue