2024-09-30 20:41:48 +00:00
|
|
|
//go:build js && wasm
|
|
|
|
// +build js,wasm
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"l12.xyz/x/shortcuts/regr/src"
|
|
|
|
|
|
|
|
"syscall/js"
|
|
|
|
)
|
|
|
|
|
|
|
|
func InitRegrExports(this js.Value, args []js.Value) interface{} {
|
2024-10-02 16:11:01 +00:00
|
|
|
exports := js.Global().Get("Object").New()
|
2024-09-30 23:58:32 +00:00
|
|
|
exports.Set("Linear", js.FuncOf(src.NewLinearRegressionJS))
|
2024-10-01 02:37:42 +00:00
|
|
|
exports.Set("ElasticNet", js.FuncOf(src.NewElasticNetJS))
|
|
|
|
exports.Set("Lasso", js.FuncOf(src.NewLassoJS))
|
2024-10-02 16:11:01 +00:00
|
|
|
exports.Set("R2Score", js.FuncOf(src.R2ScoreJS))
|
2024-10-04 04:09:41 +00:00
|
|
|
exports.Set("Logistic", js.FuncOf(src.NewLogisticRegressionJS))
|
2024-10-02 16:11:01 +00:00
|
|
|
return exports
|
2024-09-30 20:41:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
c := make(chan struct{}, 0)
|
|
|
|
js.Global().Set("__InitRegrExports", js.FuncOf(InitRegrExports))
|
|
|
|
<-c
|
|
|
|
}
|