statistics.ridgeSolve
This function gives the coefficients `beta` that solve `(gram + lambda * P) beta = moment`. - `gram` is the symmetric matrix `X'X` of size `k`, in row order. The function reads only its lower triangle. - `moment` is the vector `X'y` of length `k`. - With `lambda` 0, the result is the ordinary least-squares fit.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","ridgeSolve"]- CLI
mark statistics ridgeSolve --gram <object> --moment <object> --lambda <number>- As data
{"$proc":["statistics","ridgeSolve"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/statistics/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["statistics","ridgeSolve"], { gram: {}, moment: {}, lambda: 1 });
console.log(JSON.stringify(result));From the command line
$ mark statistics ridgeSolve --gram <object> --moment <object> --lambda <number>
As data, in a program
{
"$proc": ["statistics", "ridgeSolve"],
"input": { "gram": {}, "moment": {}, "lambda": 1 }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
gram | object | yes | ||
moment | object | yes | ||
lambda | number | yes | ||
options | object | no |
Output
The schema does not list fields (number[]).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"gram": {
"type": "object",
"properties": {
"length": {
"type": "number"
}
},
"required": [
"length"
],
"additionalProperties": {}
},
"moment": {
"type": "object",
"properties": {
"length": {
"type": "number"
}
},
"required": [
"length"
],
"additionalProperties": {}
},
"lambda": {
"type": "number"
},
"options": {
"type": "object",
"properties": {
"free": {
"type": "array",
"items": {
"type": "number"
},
"description": "The indexes of the coefficients with no penalty, for example 0 for an intercept. The default is none."
}
},
"additionalProperties": {}
}
},
"required": [
"gram",
"moment",
"lambda"
],
"additionalProperties": false
},
"output": {
"type": "array",
"items": {
"type": "number"
}
}
}