About | Installation | Dependencies | Attribution | Contributions | Issues | License | Acknowledgements
The s-capped simplex is defined as:
Geometrically, the simplex is a slice at
Projecting a vector onto a simplex is an important subproblem that appears in
imaging, statistics, and machine learning applications 1 2 3.
The projection of vector
This software computes the projection of vectors onto s-capped and positive
simplices (simplices where
import numpy as np
from simplexers import capped, positive
rng = np.random.default_rng()
x = rng.uniform(0, 3, size=(4, 100))
# construct capped and positive projections
capped_projection = capped.capped_simplexer(x, s=1, axis=-1)
positive_projection = positive.positive_simplexer(x, s=1, axis=-1)
# validate the sum of each of the 4 vectors is 1
print(np.allclose(np.sum(capped_projection, axis=-1), 1))
print(np.allclose(np.sum(positive_projection, axis=-1), 1))Simplexers is available on pypi for easy intallation into virtual environments.
- Create your virtual environment, Here we name it
my_venv.
$ python3 -m venv my_venv- Activate your 'my_venv' environment
$ source my_venv/bin/activate- Install openseize into your virtual environment
(my_venv)$ pip install simplexers-
Download the simplexers environment configuration yaml
-
Create a conda simplexers environment.
$ conda env create --file environment.yml- Activate the
simplexersenvironment.
$ conda activate simplexersTo get the development version:
- Create a virtual environment with latest pip version.
$ python3 -m venv env
$ source env/bin/activate
$ pip install --upgrade pip- Get the source code
$ git clone https://github.com/mscaudill/simplexers.git- CD into the directory containing the pyproject.toml and create an
editable install with
pipusing the development dependencies
$ pip install -e .[dev]Simplexers requires Python ≥ 3.10 and has the following dependencies:
| package | pypi | conda |
|---|---|---|
| numpy | https://pypi.org/project/numpy/ | ✓ |
| scipy | https://pypi.org/project/scipy/ | ✓ |
| ipython | https://pypi.org/project/ipython/ | ✓ |
| notebook | https://pypi.org/project/jupyter/ | ✓ |
Please see the Cite this repository under the About section or the citation file.
Contributions are what makes open-source fun and we would love for you to contribute. Please check out our contribution guide to get started.
Simplexers provides custom issue templates for filing bugs, requesting feature enhancements, suggesting documentation changes, or just asking questions. You can file an issue here.
Simplexers is licensed under the terms of the 3-Clause BSD License.
This work is generously supported through the Ting Tsung and Wei Fong Chao Foundation