save progress
This commit is contained in:
parent
60b929db2b
commit
2ad3e91a2c
21
notebooks/assets/X_Y_Sinusoid_Data.csv
Normal file
21
notebooks/assets/X_Y_Sinusoid_Data.csv
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
x,y
|
||||||
|
0.03857092316235833,0.06639132321684607
|
||||||
|
0.16677634653232146,1.0274832977473267
|
||||||
|
0.1831527336532205,1.2453018088581933
|
||||||
|
0.1873586470614216,1.0047814627724303
|
||||||
|
0.2431156753134085,1.2641206967402017
|
||||||
|
0.2892992815482438,0.4983300116283211
|
||||||
|
0.3428052291614103,0.5975017977451754
|
||||||
|
0.3454986400504001,0.629410260984959
|
||||||
|
0.3864771696146654,0.8227045670178283
|
||||||
|
0.4300468142111865,0.5575805722415722
|
||||||
|
0.4844984551528021,0.5650526186807526
|
||||||
|
0.4919289392847462,-0.3932219581301353
|
||||||
|
0.6149324753622187,-0.912891706931243
|
||||||
|
0.6380539847173851,-1.1282498703551047
|
||||||
|
0.6977363851237776,-1.1104554694371696
|
||||||
|
0.7024274240680553,-0.5703425644056388
|
||||||
|
0.7290856206264126,-0.6202092269771708
|
||||||
|
0.8734008431011248,-0.8732355889131802
|
||||||
|
0.8980071182251496,-0.18747150111083224
|
||||||
|
0.9509640316267164,-0.02581538043416365
|
|
101
notebooks/deno_tinygo_wasm.ipynb
vendored
101
notebooks/deno_tinygo_wasm.ipynb
vendored
File diff suppressed because one or more lines are too long
3
package.json
vendored
3
package.json
vendored
|
@ -7,5 +7,8 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"nodejs-polars": "^0.15.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
plot/mod.wasm
BIN
plot/mod.wasm
Binary file not shown.
|
@ -86,6 +86,8 @@ func PlotterLinesFromJSObject(object js.Value, plt *plot.Plot, plotters *[]plot.
|
||||||
g.Shape = draw.PlusGlyph{}
|
g.Shape = draw.PlusGlyph{}
|
||||||
case "ring":
|
case "ring":
|
||||||
g.Shape = draw.RingGlyph{}
|
g.Shape = draw.RingGlyph{}
|
||||||
|
case "circle":
|
||||||
|
g.Shape = draw.CircleGlyph{}
|
||||||
case "square":
|
case "square":
|
||||||
g.Shape = draw.SquareGlyph{}
|
g.Shape = draw.SquareGlyph{}
|
||||||
case "triangle":
|
case "triangle":
|
||||||
|
@ -172,7 +174,7 @@ func PlotterLinesFromJSObject(object js.Value, plt *plot.Plot, plotters *[]plot.
|
||||||
if legend != "" {
|
if legend != "" {
|
||||||
plt.Legend.Add(legend, l, lp)
|
plt.Legend.Add(legend, l, lp)
|
||||||
}
|
}
|
||||||
case "fitLinear":
|
case "trend":
|
||||||
X := make([]float64, len(XYs))
|
X := make([]float64, len(XYs))
|
||||||
Y := make([]float64, len(XYs))
|
Y := make([]float64, len(XYs))
|
||||||
min := XYs[0].Y
|
min := XYs[0].Y
|
||||||
|
|
22
regr/main.go
Normal file
22
regr/main.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//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{} {
|
||||||
|
exports := args[0]
|
||||||
|
exports.Set("ABCD", js.FuncOf(src.ABCD))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
c := make(chan struct{}, 0)
|
||||||
|
js.Global().Set("__InitRegrExports", js.FuncOf(InitRegrExports))
|
||||||
|
<-c
|
||||||
|
}
|
16
regr/src/Linear.go
Normal file
16
regr/src/Linear.go
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//go:build js && wasm
|
||||||
|
// +build js,wasm
|
||||||
|
|
||||||
|
package src
|
||||||
|
|
||||||
|
import "syscall/js"
|
||||||
|
|
||||||
|
// ref: mat.Dense
|
||||||
|
// fit: solve least squares
|
||||||
|
// predict: predict y from x
|
||||||
|
// save: save model
|
||||||
|
// load: load model
|
||||||
|
// note: separate wasm/js glue
|
||||||
|
func ABCD(this js.Value, args []js.Value) interface{} {
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in a new issue