Metadata-Version: 2.5
Name: yeom
Version: 0.2.0
Summary: Simple statistics and machine learning utilities
Author: YU Jaemyoung
License: Copyright 2025 YU Jaemyoung
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE
Keywords: design-of-experiments,machine-learning,statistics,utils
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Requires-Dist: numpy>=1.22
Requires-Dist: pandas>=1.4
Requires-Dist: patsy>=0.5
Requires-Dist: pillow>=9.0
Requires-Dist: scipy>=1.8
Requires-Dist: statsmodels>=0.13
Provides-Extra: test
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# yeom

`yeom` is a collection of simple utilities for statistics, machine learning,
design of experiments, and image processing.

## Installation

Install the package from the repository root:

```bash
python -m pip install .
```

To install the package in editable mode with its test dependencies:

```bash
python -m pip install -e ".[test]"
```

Python 3.9 or later is required.

## Converting an OpenCV image to Pillow

`to_pil` converts an OpenCV image array to a `PIL.Image.Image` object.
OpenCV is not installed as a dependency of `yeom`; install exactly one OpenCV
package appropriate for your environment if you need it to load images.

```python
import cv2 as cv

from yeom import to_pil

cv_image = cv.imread("sample.png", cv.IMREAD_UNCHANGED)
if cv_image is None:
    raise FileNotFoundError("sample.png")

pil_image = to_pil(cv_image)
pil_image.show()
```

The conversion depends on the shape of the input array:

| Input array | Conversion | Pillow mode |
| --- | --- | --- |
| `(height, width)` | Preserve grayscale values | `L` |
| `(height, width, 3)` | BGR → RGB | `RGB` |
| `(height, width, 4)` | BGRA → RGBA | `RGBA` |

For arrays whose dtype is not `uint8`, values are clipped to the range 0–255
and then converted to `uint8`. Arrays with unsupported dimensions or channel
counts raise `ValueError`.

## Design-of-experiments utilities

`yeom.doe` includes utilities for calculating variance inflation factors,
estimating regression-coefficient power and required sample sizes, and
generating D-optimal designs.

```python
from yeom import doe

design, determinant = doe.coordinate_exchange(4, "A + B")
print(design)
print(determinant)
```

## Testing

```bash
pytest
```

## License

[MIT License](LICENSE)
