Practical overview
When it fits
Use Onn when a Python/PyTorch experiment needs online classifier updates or a contextual-bandit workflow that combines nonlinear exploitation with Thompson Sampling exploration.
Who it is for
- Python developers experimenting with incrementally trained classifiers.
- Researchers exploring adaptive hidden-layer use in online neural networks.
- Developers implementing nonlinear contextual-bandit selection and reward-based updates.
Documented uses
- Train a classifier incrementally on incoming labeled examples and predict classes.
- Experiment with automatic adjustment of hidden-layer use during online learning.
- Select an action for a context and update a nonlinear bandit model using feedback.
Requirements & limits
The public GitHub repository lists an Apache-2.0 license. The README documents installation with `pip install onn`.
- The library provides distinct ONN classification and ONN_THS contextual-bandit workflows.
- Batch processing is available for experimentation, but the README recommends online use.
- CUDA use is documented when available; the README cautions that CPU may be faster for very small networks.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Onn and start an incremental classifier
Install the package, initialize a classifier, update it with labeled examples, and request predictions.
Before you start
- Python environment
- NumPy
- PyTorch, as the implementation framework
Steps
Install the package with the command below.
pip install onnImport NumPy and
ONNfromonn.OnlineNeuralNetwork.Initialize
ONNwith feature size, maximum hidden layers, neurons per hidden layer, and class count.Call
partial_fitwith labeled examples, then callpredictwith input examples.
Expected outcome
A configured ONN classifier can be incrementally trained and used to produce class predictions.
Guide limitations
- The README gives a small illustrative example, not a performance guarantee.
- Batch operation is described as available for experimentation, but online learning is the recommended use.
Use ONN_THS for contextual-bandit selection and updates
Initialize the contextual-bandit model, select an action for a context, and submit the documented update.
Before you start
- Python environment
- NumPy
- PyTorch, as the implementation framework
- Context input and an application-defined reward signal
Steps
Import NumPy and
ONN_THSfromonn.OnlineNeuralNetwork.Initialize it with feature size, maximum hidden layers, neurons per hidden layer, and number of classes.
Call
predictwith a context to obtain the selected arm and exploration factor.Update with
partial_fit, passing the context, selected arm, and exploration factor as shown in the README.
Expected outcome
The documented example returns an action selection and passes its associated values into an online model update.
Guide limitations
- The README describes select and reward actions but the short code example does not show a separate reward-value parameter.
- The repository points to a notebook for fuller examples.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 15 October 2026
- Original website title
- alison-carrera/onn · Official homepage title · retained in its source language

