NDWasmOptimize
- Description:
Namespace for Optimization functions using Go WASM.
- Source:
Methods
(static) linearRegression(x, y) → {Object}
- Description:
Fits a simple linear regression model: Y = alpha + beta*X.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
x |
NDArray | The independent variable (1D NDArray of float64). |
y |
NDArray | The dependent variable (1D NDArray of float64). |
Throws:
-
If WASM runtime is not loaded or inputs are invalid.
- Type
- Error
Returns:
- An object containing the intercept (alpha) and slope (beta) of the fitted line.
- Type
- Object
(static) linprog(c, G, h, A, b, bounds) → {Object}
- Description:
Provides Optimization capabilities by wrapping Go WASM functions. minimize cᵀ * x s.t G * x <= h A * x = b lower <= x <= upper
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
c |
NDArray | Coefficient vector for the objective function (1D NDArray of float64). |
G |
NDArray | null | Coefficient matrix for inequality constraints (2D NDArray of float64). |
h |
NDArray | null | Right-hand side vector for inequality constraints (1D NDArray of float64). |
A |
NDArray | null | Coefficient matrix for equality constraints (2D NDArray of float64). |
b |
NDArray | null | Right-hand side vector for equality constraints (1D NDArray of float64). |
bounds |
Array | Optional variable bounds as an array of [lower, upper] pairs. Use null for unbounded. [0, null] for all for default. |
Throws:
-
If WASM runtime is not loaded or inputs are invalid.
- Type
- Error
Returns:
- The optimization result.
- Type
- Object
(static) minimize(func, x0, optionsopt) → {Object}
- Description:
Finds the minimum of a scalar function of one or more variables using an L-BFGS optimizer.
- Source:
Parameters:
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
func |
function | The objective function to be minimized. It must take a 1D |
|||||||||
x0 |
NDArray | The initial guess for the optimization (1D NDArray of float64). |
|||||||||
options |
Object |
<optional> |
Optional parameters. Properties
|
Returns:
The optimization result.
- Type
- Object