mirror of
https://github.com/sjwhitworth/golearn.git
synced 2025-04-26 13:49:14 +08:00
Merge d252e1174b1ba554833ebde97fff6d25f3d28310 into 74ae077eafb245fa3bdca0288854b6d51f97fe60
This commit is contained in:
commit
93431bb388
@ -7,7 +7,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/gonum/matrix"
|
||||
"github.com/sjwhitworth/golearn/base"
|
||||
"github.com/sjwhitworth/golearn/kdtree"
|
||||
"github.com/sjwhitworth/golearn/metrics/pairwise"
|
||||
@ -430,7 +429,7 @@ func NewKnnRegressor(distfunc string) *KNNRegressor {
|
||||
|
||||
func (KNN *KNNRegressor) Fit(values []float64, numbers []float64, rows int, cols int) {
|
||||
if rows != len(values) {
|
||||
panic(matrix.ErrShape)
|
||||
panic(mat.ErrShape)
|
||||
}
|
||||
|
||||
KNN.Data = mat.NewDense(rows, cols, numbers)
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"github.com/sjwhitworth/golearn/base"
|
||||
|
||||
"fmt"
|
||||
_ "github.com/gonum/blas"
|
||||
_ "gonum.org/v1/gonum/blas"
|
||||
"gonum.org/v1/gonum/mat"
|
||||
)
|
||||
|
||||
|
@ -3,7 +3,6 @@ package pairwise
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/gonum/matrix"
|
||||
"gonum.org/v1/gonum/mat"
|
||||
)
|
||||
|
||||
@ -17,7 +16,7 @@ func (c *Chebyshev) Distance(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
|
||||
r1, c1 := vectorX.Dims()
|
||||
r2, c2 := vectorY.Dims()
|
||||
if r1 != r2 || c1 != c2 {
|
||||
panic(matrix.ErrShape)
|
||||
panic(mat.ErrShape)
|
||||
}
|
||||
|
||||
max := float64(0)
|
||||
|
@ -3,7 +3,6 @@ package pairwise
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/gonum/matrix"
|
||||
"gonum.org/v1/gonum/mat"
|
||||
)
|
||||
|
||||
@ -24,7 +23,7 @@ func (c *Cranberra) Distance(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
|
||||
r1, c1 := vectorX.Dims()
|
||||
r2, c2 := vectorY.Dims()
|
||||
if r1 != r2 || c1 != c2 {
|
||||
panic(matrix.ErrShape)
|
||||
panic(mat.ErrShape)
|
||||
}
|
||||
|
||||
sum := .0
|
||||
|
@ -3,7 +3,6 @@ package pairwise
|
||||
import (
|
||||
"math"
|
||||
|
||||
"github.com/gonum/matrix"
|
||||
"gonum.org/v1/gonum/mat"
|
||||
)
|
||||
|
||||
@ -19,7 +18,7 @@ func (m *Manhattan) Distance(vectorX *mat.Dense, vectorY *mat.Dense) float64 {
|
||||
r1, c1 := vectorX.Dims()
|
||||
r2, c2 := vectorY.Dims()
|
||||
if r1 != r2 || c1 != c2 {
|
||||
panic(matrix.ErrShape)
|
||||
panic(mat.ErrShape)
|
||||
}
|
||||
|
||||
result := .0
|
||||
|
Loading…
x
Reference in New Issue
Block a user