1.0.4 • Published 1 year ago

suprisal v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

suprisal

Compute the suprisal of an event given its probability.

Installation

npm i suprisal

Usage

import suprisal from 'suprisal'

suprisal(0.5) // returns 1.0

suprisal(1.0) // returns 0.0

suprisal(0.0) // returns Infinity

Suprisal is given in bits (base 2) by default, however you can also specify other bases via the second argument. For example, to compute suprisal in nats (base 10):

suprisal(0.5, base=10) // returns 0.301
1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago