Cortex

Machine learning, data structures, and temporal computation without dependencies.
Purpose
Platform-native algorithms using Math APIs and Node.js built-ins. Build neural networks, matrix operations, schema validation, and holiday calculations using pure JavaScript primitives.
Structured learning that adapts rather than couples to AI service evolution. Matrix operations optimized for V8 engine performance. Temporal computation with governmental precision across 30+ countries.
Install
npm install @raven-js/cortex
Usage
import { NeuralNetwork, LinearRegression } from "@raven-js/cortex";
const nn = new NeuralNetwork([2, 4, 1]);
nn.trainBatch(
[
[0, 0],
[0, 1],
[1, 0],
[1, 1],
],
[[0], [1], [1], [0]]
);
console.log(nn.predict([1, 0]));
const regression = new LinearRegression();
regression.trainBatch([
{ x: 1, y: 2 },
{ x: 2, y: 4 },
{ x: 3, y: 6 },
]);
console.log(regression.predict({ x: 4 }));
import { Matrix, Schema } from "@raven-js/cortex";
const matrix = Matrix.random(3, 3);
const result = matrix.multiply(Matrix.identity(3));
console.log(result.toString());
class User extends Schema {
name = Schema.field("", { description: "User name" });
age = Schema.field(0, { description: "User age" });
}
const user = new User();
user.validate({ name: "Alice", age: 25 });
import {
calculateEasterSunday,
calculateHolidaysOfYear,
} from "@raven-js/cortex";
const easter2024 = calculateEasterSunday(2024);
console.log(easter2024);
const usHolidays = calculateHolidaysOfYear({
year: 2024,
country: "US",
region: "CA",
});
console.log(usHolidays.length);
Module Architecture
Cortex organizes intelligence into three specialized modules:
- Learning - Neural networks, linear regression, and base model classes for machine learning tasks
- Structures - Matrix operations and schema validation for data manipulation and type safety
- Temporal - Holiday calculations and date utilities covering 30+ countries with governmental precision
Each module can be imported individually for tree-shaking optimization:
import { NeuralNetwork } from "@raven-js/cortex/learning";
import { Matrix } from "@raven-js/cortex/structures";
import { calculateEasterSunday } from "@raven-js/cortex/temporal";
Requirements
- Node.js 22.5+
- ESM module support
The Raven's Cortex
Ravens process information through distributed neural networks, sharing learning across the murder. Cortex mirrors this collective intelligence—adaptive algorithms that strengthen through usage, not coupling to external frameworks.
🦅 Support RavenJS Development
If you find RavenJS helpful, consider supporting its development:

Your sponsorship helps keep RavenJS zero-dependency, modern, and developer-friendly.
Built with ❤️ by Anonyfox