gcor 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gcor-0.1.0/.gitignore +4 -0
- gcor-0.1.0/LICENSE +21 -0
- gcor-0.1.0/Makefile +34 -0
- gcor-0.1.0/PKG-INFO +50 -0
- gcor-0.1.0/README.md +31 -0
- gcor-0.1.0/README_USER.md +62 -0
- gcor-0.1.0/README_USER.qmd +60 -0
- gcor-0.1.0/docs/gcor.html +463 -0
- gcor-0.1.0/docs/index.html +7 -0
- gcor-0.1.0/docs/search.js +46 -0
- gcor-0.1.0/pyproject.toml +30 -0
- gcor-0.1.0/src/gcor/__init__.py +27 -0
- gcor-0.1.0/src/gcor/_core.py +207 -0
- gcor-0.1.0/src/gcor/api.py +179 -0
- gcor-0.1.0/tests/data/iris.csv +153 -0
- gcor-0.1.0/tests/test_discretize.py +77 -0
- gcor-0.1.0/tests/test_gcor_basic.py +229 -0
- gcor-0.1.0/tests/test_gcor_examples.py +84 -0
- gcor-0.1.0/tests/test_qcut_edf.py +55 -0
- gcor-0.1.0/tests/test_quantile_edf.py +136 -0
- gcor-0.1.0/uv.lock +3158 -0
gcor-0.1.0/.gitignore
ADDED
gcor-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryota Suzuki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
gcor-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.PHONY: sync test testv build install-check docs check clean
|
|
2
|
+
|
|
3
|
+
# Install dependencies (including development extras)
|
|
4
|
+
sync:
|
|
5
|
+
uv sync --extra dev
|
|
6
|
+
|
|
7
|
+
# Run tests quietly
|
|
8
|
+
test:
|
|
9
|
+
uv run pytest -q
|
|
10
|
+
|
|
11
|
+
# Run tests with stdout/stderr
|
|
12
|
+
testv:
|
|
13
|
+
uv run pytest -s
|
|
14
|
+
|
|
15
|
+
# Build source distribution and wheel (equivalent to R CMD build)
|
|
16
|
+
build:
|
|
17
|
+
uv run python -m build
|
|
18
|
+
|
|
19
|
+
# Build HTML docs with pdoc
|
|
20
|
+
# - Adjust "gcor" to your top-level package/module name.
|
|
21
|
+
# - "docs" is a convenient output dir for GitHub Pages.
|
|
22
|
+
docs:
|
|
23
|
+
uv run quarto render README_USER.qmd
|
|
24
|
+
@VERSION=$$(uv run python -c "import tomllib; from pathlib import Path; d=tomllib.loads(Path('pyproject.toml').read_text(encoding='utf-8')); print(d['project']['version'])"); \
|
|
25
|
+
rm -rf docs; \
|
|
26
|
+
uv run pdoc --docformat numpy --math --footer-text "gcor v$${VERSION}" -o docs gcor
|
|
27
|
+
|
|
28
|
+
# Full check before release (rough equivalent of R CMD CHECK)
|
|
29
|
+
check: sync test build docs
|
|
30
|
+
@echo "✔ All checks completed successfully."
|
|
31
|
+
|
|
32
|
+
# Remove build artifacts and temporary environments
|
|
33
|
+
clean:
|
|
34
|
+
rm -rf dist build *.egg-info .venv-check docs
|
gcor-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gcor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Generalized correlation measures
|
|
5
|
+
Author-email: Ryota Suzuki <suzuki@ef-prime.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Requires-Dist: numpy>=1.21
|
|
9
|
+
Requires-Dist: pandas>=1.5
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
12
|
+
Requires-Dist: ipykernel; extra == 'dev'
|
|
13
|
+
Requires-Dist: jupyter; extra == 'dev'
|
|
14
|
+
Requires-Dist: pdoc; extra == 'dev'
|
|
15
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
16
|
+
Requires-Dist: pyyaml; extra == 'dev'
|
|
17
|
+
Requires-Dist: twine; extra == 'dev'
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# `gcor` library for Python
|
|
21
|
+
A Python implementation of generalized correlation measure.
|
|
22
|
+
|
|
23
|
+
**Note that this project is in an early stage of development, so changes
|
|
24
|
+
may occur frequently.**
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
Documentation site (user guide and API reference)
|
|
29
|
+
: <https://r-suzuki.github.io/gcor-py/>
|
|
30
|
+
|
|
31
|
+
User guide
|
|
32
|
+
: `README_USER.md`
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
This project uses `uv` and `Makefile` targets.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
make sync # install dependencies (incl. dev)
|
|
40
|
+
make test # run tests
|
|
41
|
+
make testv # run tests (verbose)
|
|
42
|
+
make docs # build docs (pdoc + README_USER)
|
|
43
|
+
make build # build sdist/wheel
|
|
44
|
+
make check # full check before release
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## References
|
|
48
|
+
|
|
49
|
+
`gcor` package for R
|
|
50
|
+
: <https://github.com/r-suzuki/gcor-r>
|
gcor-0.1.0/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# `gcor` library for Python
|
|
2
|
+
A Python implementation of generalized correlation measure.
|
|
3
|
+
|
|
4
|
+
**Note that this project is in an early stage of development, so changes
|
|
5
|
+
may occur frequently.**
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
Documentation site (user guide and API reference)
|
|
10
|
+
: <https://r-suzuki.github.io/gcor-py/>
|
|
11
|
+
|
|
12
|
+
User guide
|
|
13
|
+
: `README_USER.md`
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
This project uses `uv` and `Makefile` targets.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
make sync # install dependencies (incl. dev)
|
|
21
|
+
make test # run tests
|
|
22
|
+
make testv # run tests (verbose)
|
|
23
|
+
make docs # build docs (pdoc + README_USER)
|
|
24
|
+
make build # build sdist/wheel
|
|
25
|
+
make check # full check before release
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## References
|
|
29
|
+
|
|
30
|
+
`gcor` package for R
|
|
31
|
+
: <https://github.com/r-suzuki/gcor-r>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# A Python library for generalized correlation
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
A Python implementation of generalized correlation measure. For
|
|
5
|
+
development status and source code, see
|
|
6
|
+
<https://github.com/r-suzuki/gcor-py>.
|
|
7
|
+
|
|
8
|
+
**Note that this project is in an early stage of development, so changes
|
|
9
|
+
may occur frequently.**
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
``` bash
|
|
14
|
+
pip install git+https://github.com/r-suzuki/gcor-py.git
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
**Generalized correlation measure** takes values in $[0, 1]$ and can
|
|
20
|
+
capture both linear and nonlinear associations. It naturally handles
|
|
21
|
+
mixed data types, including numerical and categorical variables.
|
|
22
|
+
|
|
23
|
+
### Scalar example
|
|
24
|
+
|
|
25
|
+
``` python
|
|
26
|
+
from gcor import gcor
|
|
27
|
+
|
|
28
|
+
x = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
|
|
29
|
+
y = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7]
|
|
30
|
+
|
|
31
|
+
g = gcor(x, y)
|
|
32
|
+
print(g)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
0.5345224838248488
|
|
36
|
+
|
|
37
|
+
### Matrix example (mixed numeric and categorical data)
|
|
38
|
+
|
|
39
|
+
``` python
|
|
40
|
+
import pandas as pd
|
|
41
|
+
|
|
42
|
+
df = pd.DataFrame({
|
|
43
|
+
"x": x,
|
|
44
|
+
"y": y,
|
|
45
|
+
"z": ["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"],
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
gmat = gcor(df)
|
|
49
|
+
print(gmat)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
x y z
|
|
53
|
+
x 1.000000 0.534522 0.838289
|
|
54
|
+
y 0.534522 1.000000 0.763233
|
|
55
|
+
z 0.838289 0.763233 1.000000
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
|
|
59
|
+
### Method Overview
|
|
60
|
+
|
|
61
|
+
- [English](https://r-suzuki.github.io/gcor/method.html)
|
|
62
|
+
- [Japanese](https://r-suzuki.github.io/gcor/method_ja.html)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: A Python library for generalized correlation
|
|
3
|
+
format: gfm
|
|
4
|
+
jupyter: python3
|
|
5
|
+
execute:
|
|
6
|
+
echo: true
|
|
7
|
+
warning: false
|
|
8
|
+
error: false
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
A Python implementation of generalized correlation measure. For development status and source code, see
|
|
12
|
+
<https://github.com/r-suzuki/gcor-py>.
|
|
13
|
+
|
|
14
|
+
**Note that this project is in an early stage of development, so changes
|
|
15
|
+
may occur frequently.**
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install git+https://github.com/r-suzuki/gcor-py.git
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
**Generalized correlation measure** takes values in $[0, 1]$ and can capture
|
|
26
|
+
both linear and nonlinear associations. It naturally handles mixed data types,
|
|
27
|
+
including numerical and categorical variables.
|
|
28
|
+
|
|
29
|
+
### Scalar example
|
|
30
|
+
|
|
31
|
+
```{python}
|
|
32
|
+
from gcor import gcor
|
|
33
|
+
|
|
34
|
+
x = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]
|
|
35
|
+
y = [1, 2, 3, 4, 5, 3, 4, 5, 6, 7]
|
|
36
|
+
|
|
37
|
+
g = gcor(x, y)
|
|
38
|
+
print(g)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Matrix example (mixed numeric and categorical data)
|
|
42
|
+
|
|
43
|
+
```{python}
|
|
44
|
+
import pandas as pd
|
|
45
|
+
|
|
46
|
+
df = pd.DataFrame({
|
|
47
|
+
"x": x,
|
|
48
|
+
"y": y,
|
|
49
|
+
"z": ["a", "a", "b", "b", "c", "c", "d", "d", "e", "e"],
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
gmat = gcor(df)
|
|
53
|
+
print(gmat)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Documentation
|
|
57
|
+
|
|
58
|
+
### Method Overview
|
|
59
|
+
- [English](https://r-suzuki.github.io/gcor/method.html)
|
|
60
|
+
- [Japanese](https://r-suzuki.github.io/gcor/method_ja.html)
|