-
Notifications
You must be signed in to change notification settings - Fork 1
/
kmeans.go
35 lines (30 loc) · 871 Bytes
/
kmeans.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package kmeans
import (
"github.com/nextmv-io/sdk/connect"
"github.com/nextmv-io/sdk/measure"
)
// NewSolveOptions returns default solver options.
func NewSolveOptions() SolveOptions {
connect.Connect(con, &newSolveOptions)
return newSolveOptions()
}
// NewModel creates a new Model with the given points and number of clusters.
func NewModel(
points []measure.Point,
clusters int,
option ...Option,
) (Model, error) {
connect.Connect(con, &newModel)
return newModel(points, clusters, option...)
}
// NewSolver returns a new Solver.
func NewSolver(model Model) (Solver, error) {
connect.Connect(con, &newSolver)
return newSolver(model)
}
var (
con = connect.NewConnector("sdk", "KMeans")
newSolveOptions func() SolveOptions
newSolver func(Model) (Solver, error)
newModel func([]measure.Point, int, ...Option) (Model, error)
)