81trust / 100
Linear Regression
by Linear regression (OLS) in Productivity & SaaS
x402 APIPassing, checked 3 h ago
Fit a least-squares line y = slope·x + intercept to two equal-length series. Returns slope, intercept, r² (variance explained), and optionally predicted y values for new x inputs - useful for trend extrapolation (e.g. project next quarter's revenue from the last 8 quarters).
POST https://agent402.tools/api/linear-regression
Last 30 days
All checks passedSome failedAll failedNot checked
- Uptime
- 100%
- Response time
- 203 ms typical, 203 ms slowest 5%
- Last check
- 3 h ago
- Next check
- any minute now
How to call it
# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/linear-regression" \
-H "content-type: application/json" \
-d '{"predict":[6,7],"x":[1,2,3,4,5],"y":[2.1,4,6.1,7.9,10.2]}'import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client().register(
"eip155:8453",
new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? Preflight it first for $0.03:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Flinear-regression
const res = await pay("https://agent402.tools/api/linear-regression", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"predict":[6,7],"x":[1,2,3,4,5],"y":[2.1,4,6.1,7.9,10.2]}),
});
console.log(await res.json());Example input
{
"predict": [
6,
7
],
"x": [
1,
2,
3,
4,
5
],
"y": [
2.1,
4,
6.1,
7.9,
10.2
]
}Example output
{
"equation": "y = 2.01x + 0.03",
"intercept": 0.03,
"n": 5,
"predictions": [
{
"x": 6,
"y": 12.09
},
{
"x": 7,
"y": 14.1
}
],
"rSquared": 0.9997,
"slope": 2.01
}Security scan
- No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 3 h ago | Passed | 402 | 203 ms | $0.001 |