Metadata-Version: 2.4
Name: hdim_opt
Version: 2.0.0
Summary: Numerical optimization, sampling, and analysis toolkit for high-dimensional functions and data.
Author-email: Julian Soltes <jsoltes@regis.edu>
License: MIT
Project-URL: Homepage, https://github.com/jgsoltes/hdim-opt
Project-URL: Repository, https://github.com/jgsoltes/hdim-opt
Project-URL: Issues, https://github.com/jgsoltes/hdim-opt/issues
Project-URL: Changelog, https://github.com/jgsoltes/hdim-opt/releases
Project-URL: Documentation, https://github.com/jgsoltes/hdim-opt/blob/main/README.md
Project-URL: QUASAR Paper, https://arxiv.org/abs/2511.13843
Project-URL: HDS Paper, https://arxiv.org/abs/2511.07836
Keywords: high-dimensional,optimization,black-box-optimization,evolutionary-algorithm,quasi-monte-carlo,sensitivity-analysis,symbolic-regression,stepAIC,quasar
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Natural Language :: English
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: scikit-learn
Requires-Dist: pandas
Requires-Dist: matplotlib
Requires-Dist: seaborn
Requires-Dist: SALib
Requires-Dist: gplearn
Requires-Dist: statsmodels
Provides-Extra: kde
Requires-Dist: numba; extra == "kde"
Provides-Extra: all
Requires-Dist: hdim_opt[kde]; extra == "all"

# hdim-opt: High-Dimensional Optimization Toolkit

[![PyPI](https://img.shields.io/pypi/v/hdim-opt)](https://pypi.org/project/hdim-opt/)
![Python Versions](https://img.shields.io/pypi/pyversions/hdim-opt)
![License](https://img.shields.io/pypi/l/hdim-opt)

`hdim_opt` is a lightweight Python toolkit to streamline numerical optimization, sampling, and analysis for high-dimensional functions and datasets. Several functions are provided to address quasi-Monte Carlo sampling, gradient-based & non-parametric optimization, statistical analysis, regression & feature selection, data transformation & visualization.

All core functions, listed below, are single-line executable and depend on three essential parameters: [obj_function, bounds, n_samples]:

### Sampling
* **uniform**: Generate uniform QMC sample sequences (via scipy.stats.qmc).
- **hyperellipsoid**: Non-uniform Hyperellipsoid Density Sampling designed to accelerate high-dimensional optimization.
* **isotropize**: Isotropize the input data via zero-phase component analysis (ZCA).
* **encode_bipolar**: Bipolar-logarithmic transform, for data (or bounds) spanning both negative values and exponents.

### Optimization
* **quasar**: Optimization using the QUASAR evolutionary algorithm.
* **minimize**: Optimization using gradient-based minimization (via scipy.minimize).
* **symbolic**: Symbolic regression to approximate the input data or function (via gplearn).
* **stepAIC**: Stepwise feature selection for linear or logistic regression (akin to R's MASS:stepAIC).

### Risk
* **volatility**: Quantifies the objective function volatility of a solution within its local landscape.
* **risk_analysis**: Analyzes the risk metrics for a given 1-D distribution (i.e., the volatility output).

### Analysis
* **sensitivity**: Sensitivity analysis to quantify each dimension's influence (via SALib).
* **hyperslice**: Create a hyperslice of the function's underlying solution space.
* **waveform**: Decompose any 2D waveform.
* **analyze**: Analyze any input dataset.


## Installation
Install `hdim_opt` from PyPI:

```bash
pip install hdim_opt
```

## Example Usage
```python
import hdim_opt as h

### Parameter Space
n_samples = 2**10
n_dimensions = 100
bounds = [(-1,1)] * n_dimensions # Parameter bounds
obj_func = h.test_functions.rastrigin # Test function

### Sampling
uniform_samples = h.uniform(n_samples, bounds) # Uniform sampling
ellipsoid_samples = h.hyperellipsoid(n_samples, bounds, verbose=True) # Hyperellipsoid sampling
iso_samples, iso_params = h.isotropize(ellipsoid_samples) # Isotropize data (ZCA)
bipolar_log_samples = h.encode_bipolar(iso_samples, [b[0] for b in bounds]) # Bipolar-logarithm transform

### Optimization
solution, fitness = h.quasar(obj_func, bounds, init='hyperellipsoid') # Evolutionary optimization
local_sol, local_fit = h.minimize(obj_func, bounds, init=solution) # Gradient-based optimization
all_expr, best_expr = h.symbolic(obj_func, bounds[:2]) # Symbolic regression
opt_features, opt_model = h.stepAIC(iso_samples, [obj_func(x) for x in iso_samples]) # feature selection & regression

### Risk
vol_data, vol_stats = h.volatility(obj_func, bounds, solution, noise=0.01) # Local instability of a solution
risk_stats = h.risk_analysis(vol_data['objective']) # Conditional value at risk for a 1-D distribution

### Analysis
Si, S2 = h.sensitivity(obj_func, bounds) # Sensitivity analysis
slice_data, slice_stats = h.hyperslice(obj_func, bounds, slice_dims=(0,1), n_samples=2**7) # Estimate solution space
signal_data = h.waveform(slice_data['x0'], slice_data['objective']) # Analyze 2D waveform
h.analyze(slice_data) # Analyze any numerical dataset
```


## Research & Methods
- **QUASAR Optimization:** *Quasi-Adaptive Search with Asymptotic Reinitialization*, an evolutionary algorithm for minimizing high-dimensional, non-differentiable, and non-parametric objective functions. [Read the paper on arXiv](https://arxiv.org/abs/2511.13843)
- **Hyperellipsoid Density Sampling:** A non-uniform Quasi-Monte Carlo sampling method designed to exploit promising regions of high-dimensional parameter spaces. [Read the paper on arXiv](https://arxiv.org/abs/2511.07836)

## Issues & Support
Bug reports and feature requests are very welcome, via [GitHub Issues](https://github.com/jgsoltes/hdim-opt/issues).
