NclustRL
NclustRL is a toolkit that implements some functionalities to help train agents for n-clustering tasks. It works with Ray's RLlib to train DRL agents.
Ray is a general-purpose framework for distributed computing that implements a known library for hyperparameter tunning, Tune. Furthermore, it implements RLlib, a DRL framework that supports distributed computing and great customization.
NclustRL implements a trainer API for n-clustering that handles all training tasks for the user; a set of default models and metrics; and other helpful functions. Likewise, it provides a set of default configurations for $n$-clustering tasks available in "configs".
The trainer API aims to provide a simple way of training and testing DRL agents for n-clustering tasks. This class handles all of RLlib's logic and expose only user-friendly methods.
After initialized, the trainer exposes four primary methods:
- Train: Exposes the primary training function. It receives the training parameters that should be passed on to Tune, initiates the training process, manages multiple samples of the same trial, and parses results returning the best performance obtained;
- Load: Imports an agent from a checkpoint for testing;
- Test: Evaluates the accuracy and mean reward and returns the mean and standard deviation for each of these metrics across n episodes.
- Test Dataset: Evaluates the performance in the same way as Test but receives as input a specific dataset from where episodes should be sampled.
Installation
This tool can be installed from PyPI:
pip install nclustRL
Getting started
Here are the basics, for more information check the Experiments available on "Exp".
## Train basic agent
from nclustRL.trainer import Trainer
from nclustRL.configs.default_configs import PPO_PBT, DEFAULT_CONFIG
from ray.rllib.agents.ppo import PPOTrainer
from nclustenv.configs import biclustering
# Inicialize Trainer
config = DEFAULT_CONFIG.copy()
config['env_config'] = biclustering.binary.basic_v2
trainer = Trainer(
trainer=PPOTrainer,
env='BiclusterEnv-v0',
save_dir='nclustRL/Exp/test',
name='test',
config=config
)
## Tune agent
best_checkpoint = trainer.train(
num_samples=8,
scheduler=PPO_PBT,
stop_iters=500,
)
Model
By default this tool implements a model for hybrid proximal policy optimization algorithm, available in "models". This model can be customized, or other models might be implemented and passed in the configs.
License
Metadata
Release files for nclustRL 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nclustRL-1.0.0.tar.gz | 19.1 kB | Without provenance | Details for nclustRL-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nclustRL-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for nclustRL-1.0.0-py3-none-any.whl |
Total release size: 52.3 kB
Release files / nclustRL-1.0.0.tar.gz
| Download URL | nclustRL-1.0.0.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ed70bb1ca4101926790058a51f3cbcc845c2101e0f40244233e822f1b8d4572
|
|
BLAKE2b-256 checksum How to use checksums |
8af13b85960b05faddff58584ebfc03ea0e0cce3197f07fd68fc9ec393fe6e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Release files / nclustRL-1.0.0-py3-none-any.whl
| Download URL | nclustRL-1.0.0-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1aeaabb8355b99ef696686229f0a9d5fcdcb10d352fa2ce4a75ee5bcdc419f82
|
|
BLAKE2b-256 checksum How to use checksums |
7a9e331dc22947292d63f44b47e7775babca68db3e7abf20dd3669b2f5ac621c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.8.10
|
Security for nclustRL 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.