native

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgMax

func ArgMax(xs []float64) int

ArgMax is the index of the largest element

func Clamp

func Clamp(x, min, max float64) float64

func Dot

func Dot(xx, yy []float64) float64

Dot product

func ExtractArray

func ExtractArray(t *vm.Table) (any, error)

extractArray reads the sequential 1..n portion of t into a typed Go slice. The element type is inferred from the values: all-strings → []string, all-ints → []int64, mixed int/float (or all-float) → []float64. Mixing strings with numbers, or any other value type, is a hard error — sorting heterogeneous values has no obvious total order so we'd rather fail loudly than guess.

func MaxOf

func MaxOf(xx []float64) float64

maxOf returns the largest element. Callers must guarantee a non-empty slice.

func Maxf

func Maxf(xs []float64) float64

func Meanf

func Meanf(xs []float64) float64

func MinOf

func MinOf(xx []float64) float64

minOf returns the smallest element. Callers must guarantee a non-empty slice.

func Minf

func Minf(xs []float64) float64

func Normalize

func Normalize(xs []float64)

Normalize scales to (0, 1)

func Round

func Round(x float64) float64

Round to nearest integer

func Sgn

func Sgn(x float64) float64

Sgn is signum

func Softmax

func Softmax(xx []float64) []float64

softmax converts a slice of scores into a probability distribution. The max is subtracted before exponentiating for numerical stability (so large inputs don't overflow Exp). An empty input yields an empty output rather than dividing by a zero sum.

func Stddevf

func Stddevf(xs []float64) float64

func Sumf

func Sumf(xs []float64) float64

func Variancef

func Variancef(xs []float64) float64

func WriteBack

func WriteBack[T any](t *vm.Table, values []T)

writeBack copies a sorted Go slice into the 1..n positions of t, matching Lua's in-place sort semantics. Indices beyond n are left untouched — callers shouldn't be putting holes in an array part anyway.

Types

This section is empty.

Directories

Path Synopsis
datascience
classification
Package classification is a require()-able host module exposing supervised classifiers to .lsc code: a Naive Bayesian text classifier, k-nearest-neighbours, a perceptron, logistic regression, and a kernel SVM.
Package classification is a require()-able host module exposing supervised classifiers to .lsc code: a Naive Bayesian text classifier, k-nearest-neighbours, a perceptron, logistic regression, and a kernel SVM.
clustering
Package clustering is a require()-able host module exposing unsupervised clustering algorithms (k-means, DBSCAN, agglomerative/hierarchical, and mean shift) to .lsc code.
Package clustering is a require()-able host module exposing unsupervised clustering algorithms (k-means, DBSCAN, agglomerative/hierarchical, and mean shift) to .lsc code.
csv
Package csv is a require()-able host module for reading and writing CSV, the lingua franca of tabular data.
Package csv is a require()-able host module for reading and writing CSV, the lingua franca of tabular data.
dataframe
Package dataframe is a require()-able host module providing a column- oriented, pandas-style tabular structure — the central abstraction for most data-science work in LuaScript.
Package dataframe is a require()-able host module providing a column- oriented, pandas-style tabular structure — the central abstraction for most data-science work in LuaScript.
linalg
Package linalg is a require()-able host module providing the vector and matrix primitives that underpin most numeric data-science work: dot products, norms, matrix multiplication, transpose, and the small dense solvers (determinant, inverse, linear solve via Gaussian elimination with partial pivoting) needed for, e.g., closed-form linear regression.
Package linalg is a require()-able host module providing the vector and matrix primitives that underpin most numeric data-science work: dot products, norms, matrix multiplication, transpose, and the small dense solvers (determinant, inverse, linear solve via Gaussian elimination with partial pivoting) needed for, e.g., closed-form linear regression.
ml
ml/luaml
Package luaml is the require()-able host module that exposes the ml neural- network engine (native/ml + native/ml/training) to LuaScript as `ml`.
Package luaml is the require()-able host module that exposes the ml neural- network engine (native/ml + native/ml/training) to LuaScript as `ml`.
ndarray
Package ndarray is a require()-able host module providing a dense, N-dimensional numeric array — the NumPy-style primitive that most data-science numerics build on.
Package ndarray is a require()-able host module providing a dense, N-dimensional numeric array — the NumPy-style primitive that most data-science numerics build on.
plot
Package plot is a require()-able host module that turns numeric data into standalone SVG charts — the "see your data" half of a data-science loop.
Package plot is a require()-able host module that turns numeric data into standalone SVG charts — the "see your data" half of a data-science loop.
stats
Package stats is a require()-able host module providing the descriptive and inferential statistics a data-science workflow reaches for first: central tendency (mean/median/mode), spread (variance/stddev/iqr/range), shape (skewness/kurtosis), relationships (covariance/correlation), and the per-element transforms (zscore/normalize/standardize) used to prepare features.
Package stats is a require()-able host module providing the descriptive and inferential statistics a data-science workflow reaches for first: central tendency (mean/median/mode), spread (variance/stddev/iqr/range), shape (skewness/kurtosis), relationships (covariance/correlation), and the per-element transforms (zscore/normalize/standardize) used to prepare features.
stdlib
bit32
Package bit32 implements the Lua 5.2-style bit32 library for 32-bit unsigned integer arithmetic.
Package bit32 implements the Lua 5.2-style bit32 library for 32-bit unsigned integer arithmetic.
db
Package db is the host-side bridge between.lsc code and Go's database/sql.
Package db is the host-side bridge between.lsc code and Go's database/sql.
debugx
Package debugx implements the `debug` native module.
Package debugx implements the `debug` native module.
enumrt
Package enumrt provides the runtime glue the bytecode generator emits calls into when lowering an `enum` declaration.
Package enumrt provides the runtime glue the bytecode generator emits calls into when lowering an `enum` declaration.
httpserver
Package httpserver provides the `httpserver` native module — an HTTP *server* to complement the client-only `http` module.
Package httpserver provides the `httpserver` native module — an HTTP *server* to complement the client-only `http` module.
iox
Package iox implements Lua 5.4's `io` library — file handles with :read/:write/:lines/:seek/:flush/:close methods, plus the module-level helpers io.open / io.lines / io.read / io.write / io.close / io.type / io.tmpfile.
Package iox implements Lua 5.4's `io` library — file handles with :read/:write/:lines/:seek/:flush/:close methods, plus the module-level helpers io.open / io.lines / io.read / io.write / io.close / io.type / io.tmpfile.
logx
Package logx implements the `log` native module: a leveled, timestamped logger usable from LuaScript.
Package logx implements the `log` native module: a leveled, timestamped logger usable from LuaScript.
os
std
structrt
Package structrt provides the runtime glue the bytecode generator emits when lowering a `struct` declaration.
Package structrt provides the runtime glue the bytecode generator emits when lowering a `struct` declaration.
timex
Package timex provides the `time` native module: wall-clock and monotonic time, sleeping, and date formatting/parsing.
Package timex provides the `time` native module: wall-clock and monotonic time, sleeping, and date formatting/parsing.
ui
Package ui exposes a thin Lua binding over Fyne v2 widgets and windows.
Package ui exposes a thin Lua binding over Fyne v2 widgets and windows.
utf8x
Package utf8x implements Lua 5.4's utf8 library.
Package utf8x implements Lua 5.4's utf8 library.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL