// readme


Raven is machine learning and scientific computing in OCaml, from neural networks to probabilistic inference to numerical methods, all the way down to the GPU, with no dependencies. It covers what NumPy, JAX, PyTorch, NumPyro, SciPy, pandas and Matplotlib cover in Python, as libraries that compose as ordinary OCaml code.

Raven is alpha. APIs will change. Feedback welcome.

(* nx โ€” n-dimensional arrays *)
let x = Nx.linspace Nx.float32 0. 10. 100
let y = Nx.sin x

(* rune โ€” automatic differentiation *)
let grad_f = Rune.grad' (fun x -> Nx.sum (Nx.mul x x)) x

(* brot โ€” tokenization *)
let tokenizer = Brot.from_file "tokenizer.json" |> Result.get_ok
let ids = Brot.encode_ids tokenizer "The meaning of life is"

(* jera โ€” numerical methods *)
let cos_integral = Jera.Quad.(fixed (Rule.gauss 10) Nx.cos (Range.v (Nx.zeros_like x) x))

(* kaun โ€” neural networks *)
let layer = Kaun.Linear.init ~key:(Nx.Rng.key 0) ~inputs:100 ~outputs:10
let logits = Kaun.Linear.apply layer x

(* talon โ€” dataframes *)
let df = Talon.v [
  "name", Talon.Column.v Talon.Type.string [| "Alice"; "Bob"; "Charlie" |];
  "score", Talon.Column.vโ€ฆ