NclustEnv
NclustEnv is a python toolkit that implements several environments for n-clustering and other functionalities, along with some default datasets and configurations.
The motivation behind NclustEnv is providing quality general environments for training and benchmarking RL-based solutions to n-clustering.
NclustEnv was implemented using NclustGen as the generator for online training, and Gym.
NclustEnv's architecture focuses on an abstract class (base) that contains the core logic and API and is, consequently, the only part that cannot be customized.
- The state abstraction: NclustEnv separates all environment logic into a separate class State; this class can be inherited for minor modification or re-implemented for significant changes. It receives actions from the main class and actuates them in the graph. It is also is responsible for sampling the space and requesting a new episode upon a reset command. Currently, there are two implemented states, the State and the Offline State classes. Intuitively the State class handles all online environments, while the Offline State class is used in offline environments.
- The space abstraction: NclustEnv also implements its observation space DGLHeteroGraphSpace, which can sample graph configurations from a distribution used with NclustGen for dataset creation.
- The metric abstraction: The base class implements the linear assignment function and all other core logic necessary to estimate the reward and send it to the agent. However, it takes a function as a parameter so that other reward functions might be used. This function should return the distance between all permutations of hidden and found clusters. The only assumption made about the metric is that it is a distance metric; hence, the objective is to minimize it. NclustEnv currently implements Jaccard Distance.
- The action abstraction: This abstraction implements a simple action container. When an action reaches the environment is parsed through the Action class. This class should implement two properties: action that contains the discrete action to take and parameters containing the vector of parameters for that action index. The base class takes a pointer to this action class as a parameter. Nonetheless, it is not advised that this action is re-implemented. Instead, to modify its behaviour, it should be inherited.
Installation
This tool can be installed from PyPI:
pip install nclustenv
Getting started
Here are the basics, for more information check the docstrings in each class.
## Use Biclustering Environment
import nclustenv
# Initialize Environment
configs = {}
env = nclustenv.make('BiclusterEnv-v0', **configs)
# Get obs space
env.observation_space
# Get action space
env.action_space
# Get state class
state = env.state
# Step in environment
obs, reward, done, info = env.step(env.action_space.sample())
# Render environment
env.render()
Currently four environments are implemented:
- 'BiclusterEnv-v0';
- 'TriclusterEnv-v0';
- 'OfflineBiclusterEnv-v0';
- 'OfflineTriclusterEnv-v0;
License
Metadata
Release files for nclustenv 0.1.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 |
|---|---|---|---|---|
| nclustenv-0.1.0.tar.gz | 38.3 kB | Without provenance | Details for nclustenv-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nclustenv-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nclustenv-0.1.0-py3-none-any.whl |
Total release size: 79.6 kB
Release files / nclustenv-0.1.0.tar.gz
| Download URL | nclustenv-0.1.0.tar.gz |
|---|---|
| Size | 38.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fef2e7c6d4f3975572fbac20364774b829f8e23f058e5b0a7f4f911150801454
|
|
BLAKE2b-256 checksum How to use checksums |
91e4a5c5f730e22072d2a664331ab6122611a0ddb13696f4b938c5020141f5d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Release files / nclustenv-0.1.0-py3-none-any.whl
| Download URL | nclustenv-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
520a079e296c4855f4b90ce1dbfa216018773db07843acc3016ef71577058d37
|
|
BLAKE2b-256 checksum How to use checksums |
6b9f8c12c21669ad9946ad8eb96210ccc7dcf872f0ffbb9b6e6bf17febbebad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5
|
Security for nclustenv 0.1.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.