cogscale
v1.0.1
Published
A JavaScript library for cognitive scaling functions including Prospect Theory, Power Law, and Weber-Fechner Law
Maintainers
Readme
CogScale
A JavaScript library for cognitive scaling functions that model human perception and decision-making.
Installation
npm install cogscaleUsage
const cogScale = require('cogscale');
// 1. Prospect Theory
// Models how people perceive gains and losses
const gain = cogScale.prospectTheory(100); // gain of 100
const loss = cogScale.prospectTheory(-100); // loss of 100
// 2. Power Area Scale
// Useful for visual area perception scaling
const scaledArea = cogScale.powerAreaScale(0.5); // scale value between 0 and 1
// 3. Weber-Fechner Law
// Models perception of changes in physical stimuli
const perception = cogScale.weberFechner(100);API
prospectTheory(x, alpha = 0.88, beta = 0.88, lambda = 2.25)
Implements Prospect Theory's value function where:
x: input value (positive for gains, negative for losses)alpha: risk aversion parameter for gainsbeta: risk aversion parameter for losseslambda: loss aversion parameter
powerAreaScale(x, a = 0.6)
Implements power law scaling for area perception where:
x: input value between 0 and 1a: power exponent (default: 0.6)
weberFechner(x, k = 1)
Implements Weber-Fechner Law where:
x: input valuek: scaling factor
License
MIT
