Skip to content

✨ Minimal library for creating neural networks

License

Notifications You must be signed in to change notification settings

littensy/nanoai

Repository files navigation

Logo

Nanoai

Minimal library for creating neural networks.
npm package →

GitHub Workflow Status NPM Version GitHub License

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

Nanoai is released under the MIT License.

MIT License

Releases

No releases published

Languages