Green Magic - Python Library
Green Magic is a library containing class models allowing users to train machine learning models as well as visualize cannabis strain data. It has functionality for encoding raw cannabis strain data into features usefull for visualization and cluster analysis. It contains implementations for model evaluation and methods for data exploration.
Key features of the Library:
Data cleaning
Seemless dataset creation
Extendable feature extraction system
Usage of the Somoclu library [1] as the backend, which allows for ‘fast execution of Self-Organizing Maps by parallelization: OpenMP and CUDA are supported’.
Visualization of maps
Kmeans and Affinity-propagation based clustering
Formatted print of statistics and distributions
Usage
A simple example is below.
from green_magic import WeedMaster
from green_magic.clustering import ClusteringFactory, DistroReporter, get_model_quality_reporter
all_vars = ['type', 'effects', 'medical', 'negatives', 'flavors']
active_vars = ['type', 'effects', 'medical', 'negatives', 'flavors']
wd = 'pd'
wm = WeedMaster()
dt = wm.create_weedataset(dt_path, wd)
dt.use_variables(active_vars)
dt.clean()
vectors = wm.get_feature_vectors(dt)
print(dt)
wm.save_dataset(wd)
som = wm.map_manager.get_som('toroid.rectangular.30.30.pca')
wm.map_manager.show_mmap(som)
clf = ClusteringFactory(wm)
cls = clf.create_clusters(som, 'kmeans', nb_clusters=10, vars=all_vars, ngrams=1)
print(cls)
cls.print_map()
r = DistroReporter()
r.print_distros(cls0, 'type', prec=3)
qr = get_model_quality_reporter(wm, wd)
print(qr.measure(cls, metric='silhouette'))
print(qr.measure(cls, metric='cali-hara'))
Installation
The code is available on PyPI, hence it can be installed by
$ pip install green_magic
Citation
Peter Wittek, Shi Chao Gao, Ik Soo Lim, Li Zhao (2017). Somoclu: An Efficient Parallel Library for Self-Organizing Maps. Journal of Statistical Software, 78(9), pp.1–21. DOI:10.18637/jss.v078.i09. arXiv:1305.1422.
Metadata
Release files for green-magic 0.5.6
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 | |
|---|---|---|---|---|
| green_magic-0.5.6.tar.gz | 28.0 kB | Without provenance | Details |
Release files / green_magic-0.5.6.tar.gz
| Download URL | green_magic-0.5.6.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
87de63eafff96da100b9ee1fd585b05bc0c3c8d5cb2b641db172b21b2cbf7884
|
|
BLAKE2b-256 checksum How to use checksums |
e239dfde853020070b4db2b16265bdcaf915da744b58eb4f8418a8a7d8b64a68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for green-magic 0.5.6
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.