Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/littensy/nanoai

✨ Minimal library for creating neural networks
https://github.com/littensy/nanoai

machine-learning neural-network roblox roblox-ts typescript

Last synced: 30 days ago
JSON representation

✨ Minimal library for creating neural networks

Awesome Lists containing this project

README

        



Logo


Nanoai



Minimal library for creating neural networks.


npm package →

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/littensy/nanoai/ci.yml?style=for-the-badge&branch=master&logo=github)
[![NPM Version](https://img.shields.io/npm/v/@rbxts/nanoai.svg?style=for-the-badge&logo=npm)](https://www.npmjs.com/package/@rbxts/nanoai)
[![GitHub License](https://img.shields.io/github/license/littensy/nanoai?style=for-the-badge)](LICENSE.md)

**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

```sh
npm install @rbxts/nanoai
yarn add @rbxts/nanoai
pnpm add @rbxts/nanoai
```

### Wally

Add `littensy/nanoai` to your `wally.toml` file.

```toml
[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

```lua
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](https://img.shields.io/github/license/littensy/nanoai?style=for-the-badge)](LICENSE.md)