<a id="readme-top"></a>

<br />
<div align="center">
  <a href="https://nrnagents.ai">
    <img src="https://arenax-logos.s3.us-east-1.amazonaws.com/nrn-agents-logo--purple.png" alt="Logo" height="80">
  </a>
</div>

<br />

<!-- BADGES -->
<div align="center">

  <!-- [![Stargazers][stars-shield]][stars-url]
  [![Unlicense License][license-shield]][license-url] -->
  [![install size][install-size-shield]][install-size-url]
  [![Twitter][twitter-shield]][twitter-url]
  [![LinkedIn][linkedin-shield]][linkedin-url]

</div>

<!-- GETTING STARTED -->
## Getting Started

This package is used for low-level control of the machine learning models that is used in 
[nrn-agents](https://github.com/ArenaX-Labs/nrn-agents--npm).

### Installation

To start using the package, you can install it as follows:

```sh
npm install nrn-ml
```

### Model Initialization

Initializing a neural network with 1 action head

```js
const { NeuralNetworkMultihead } =  require("nrn-ml")

const modelData = {
  config: {
    inputDim: 5,
    neurons: [12, 6],
    actionOrder: ["action 1", "action 2"],
    modelType: "neural-network"
  }
}

const model = new NeuralNetworkMultihead(modelData)
```

Initializing a tabular model with 2 action heads

```js
const { TabularModel } =  require("nrn-ml")

const modelData2 = {
  config: {
    inputDim: 10,
    actionNames: ["Direction", "Combat"],
    actionOrder: [["up", "down"], ["attack", "defend"]],
    actionPolicies: ["argmaxPolicy", "probabilisticSampling"],
    modelType: "simple"
  }
}

const model = new TabularModel({ metadata }, true)
```

<!-- MARKDOWN LINKS & IMAGES -->
<!-- [stars-shield]: https://img.shields.io/github/stars/ArenaX-Labs/nrn-ml--npm.svg?style=for-the-badge -->
[stars-shield]: https://img.shields.io/github/stars/ArenaX-Labs/nrn-ml--npm.svg
[stars-url]: https://github.com/ArenaX-Labs/nrn-ml--npm/stargazers
<!-- [license-shield]: https://img.shields.io/github/license/ArenaX-Labs/nrn-ml--npm.svg?style=for-the-badge -->
[license-shield]: https://img.shields.io/github/license/ArenaX-Labs/nrn-ml--npm.svg
[license-url]: LICENSE.txt
<!-- [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555 -->
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-blue.svg?logo=linkedin
[linkedin-url]: https://www.linkedin.com/company/nrn-agents/

[twitter-shield]: https://img.shields.io/badge/-Twitter-black.svg?logo=twitter
[twitter-url]: https://www.x.com/NRNAgents

[install-size-shield]: https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=nrn-agents&query=$.install.pretty&label=install%20size&style=flat-square
[install-size-url]: https://packagephobia.now.sh/result?p=nrn-agents