@rbxts/nanoai
v0.1.0
Published
Minimal library for creating neural networks
Downloads
4
Maintainers
Readme
Nanoai is a fast, lightweight library for handling multi-layer perceptron (MLP) neural networks.
The addition of recurrent and convolutional layers is not planned at this time.
📦 Setup
TypeScript
npm install @rbxts/nanoai
yarn add @rbxts/nanoai
pnpm add @rbxts/nanoai
Wally
Add littensy/nanoai
to your wally.toml
file.
[dependencies]
Nanoai = "littensy/nanoai@VERSION"
📚 API Reference
create(shape, activation)
predict(network, input)
backpropagate(network, input, expected, learningRate)
evolution(options)
init[type](network, ...)
initialize(network, initializer)
clone(network)
🚀 Examples
XOR problem
local model = Nanoai.create({ 2, 3, 1 }, Nanoai.Activation.TanH)
Nanoai.init.normal(model)
for _ = 1, 500 do
Nanoai.backpropagate(model, { 0, 1 }, { 1 }, 0.3)
Nanoai.backpropagate(model, { 1, 0 }, { 1 }, 0.3)
Nanoai.backpropagate(model, { 0, 0 }, { 0 }, 0.3)
Nanoai.backpropagate(model, { 1, 1 }, { 0 }, 0.3)
end
Nanoai.predict(model, { 0, 1 }) -- ~1