From e0048e73ae162517f5b2746b336bd1a9e502caa8 Mon Sep 17 00:00:00 2001 From: zrq <110216590+Amedar-Asterisk@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:14:30 +0800 Subject: [PATCH 1/6] Revert "Rename readme.md to README.md" --- README.md | 291 +++++------------------------------------------------- readme.md | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 312 insertions(+), 265 deletions(-) create mode 100644 readme.md diff --git a/README.md b/README.md index 7eac280..306f7df 100644 --- a/README.md +++ b/README.md @@ -1,286 +1,47 @@ -# U-Statistics-python `u-stats` -[![PyPI version](https://badge.fury.io/py/u-stat.svg)](https://badge.fury.io/py/u-stats) -[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Build Status](https://img.shields.io/github/actions/workflow/status/Amedar-Asterisk/U-Statistics-python/ci.yml?branch=main)](https://github.com/Amedar-Asterisk/U-Statistics-python/actions) - -**U-statistics** are fundamental tools in statistics, probability theory, theoretical computer science, economics, statistical physics, and machine learning. Named after Wassily Hoeffding, U-statistics provide unbiased estimators for population parameters and form the foundation for many statistical tests and methods. However, computing U-statistics can be computationally demanding, especially for high-order cases where the number of combinations grows exponentially. +# U-Statistics Python Package -This package provides a high-performance, tensor-based implementation for computing U-statistics and V-statistics with significant computational advantages: - -- Leverages the underlying combinatorial structure of kernel functions to significantly reduce computational complexity from exponential to polynomial in many cases -- Utilizes optimized einsum engines—[`numpy.einsum`](https://numpy.org/doc/stable/reference/generated/numpy.einsum.html) and [`torch.einsum`](https://pytorch.org/docs/stable/generated/torch.einsum.html)—to enable efficient computation on both CPU and GPU +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) -## Table of Contents +A Python package for efficient computation of U-statistics and V-statistics via tensor contraction. -1. [Installation](#1-installation) -2. [Requirements](#2-requirements) -3. [Example Usage](#3-example-usage) -4. [API Reference](#4-api-reference) -5. [Changelog](#7-changelog) -6. [License](#8-license) -7. [Contributing](#9-contributing) +## Features -## 1. Installation +- Efficient computation of U-statistics and V-statistics +- Support for multiple tensor backends (NumPy and PyTorch) +- Both high-level convenience functions and low-level class interfaces +- Optimized tensor operations using `opt_einsum` -Install the package from PyPI: +## Installation ```bash pip install u-stats ``` -For development installation: - -```bash -git clone https://github.com/Amedar-Asterisk/U-Statistics-python.git -cd U-Statistics-python -pip install -e . -``` - -## 2. Requirements - -### Required Dependencies -- **Python 3.11+** -- **NumPy >= 1.20.0** -- **opt_einsum >= 3.3.0** - -### Optional Dependencies -- **torch >= 1.9.0**: GPU acceleration and parallel CPU computation - -## 3. Example Usage - -### 3.1 Selection of Backend - -The package supports two computation backends for different performance needs: - -```python -from u_stats import set_backend, get_backend - -# Set backend to NumPy (default) -set_backend("numpy") # CPU computation, deterministic results - -# Set backend to PyTorch (optional) -set_backend("torch") # GPU acceleration and parallel CPU computation - -# Check current backend -current_backend = get_backend() -print(f"Current backend: {current_backend}") -``` - -### 3.2 Computing U-statistics - -[`ustat`](https://github.com/Amedar-Asterisk/U-Statistics-python/blob/main/src/u_stats/__init__.py#L92-L131) is the main function for computing U-statistics. - -Here we take a **7th-order U-statistic** with kernel function - -$$ -h(x_1,x_2,\dots,x_7) = h_1(x_1, x_2) h_2(x_2, x_3) \dots h_6(x_6, x_7) -$$ - -as an example. For samples $X = (X_1, \dots, X_n)$, the U-statistic takes the form - -$$ -U = \frac{1}{n(n-1)\cdots (n-6)} \sum_{(i_1,\dots,i_7) \in P_7}h_1(X_{i_1},X_{i_2})\cdots h_6(X_{i_6},X_{i_7}) -$$ - -where $P_7$ denotes all 7-tuples of distinct indices. - -#### 3.2.1 Tensor Assembly - -We assume that the kernel function values on samples $X$ have been precomputed and assembled into matrices $H_1, H_2, \dots, H_6 \in \mathbb{R}^{n \times n}$: - -$$ -H_k[i,j] = h_k(X_i, X_j) -$$ - -#### 3.2.2 Expression Formats - -The expression defines how kernel matrices are connected in the computation. We take this U-statistic as an example to explain how to construct expression. - -to express the structure of the kernel function $h(x_1, x_2, \dots, x_7) = h_1(x_1, x_2) \cdot h_2(x_2, x_3) \cdots h_{6}(x_{6}, x_7)$, we assign a unique index to each distinct variable $x_1, x_2, \dots, x_7$. For each factor $h_k(x_{k}, x_{k+1})$, we collect the indices of the variables it depends on into a pair. The sequence of pairs is then ordered according to the order of the factors in the product. - -We can using the following notation to represent this structure: - -**Einstein Summation Notation:** -```python -expression = "ab,bc,cd,de,ef,fg->" -``` - -**Nested List Notation:** -```python -expression = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] -``` - -**Format Explanation:** -- In Einstein notation: each letter represents an index, each string like `"ab"` represents a factor of the kernel -- In list notation: each sub-list `[i,j]` represents a factor of the kernel -Both formats are equivalent and specify the same computation pattern. - -#### 3.2.3 Complete Example - -```python -from u_stats import ustat, set_backend -import numpy as np - -# Choose computation backend -set_backend("torch") # Use torch if available -# The default is numpy - - -# Set number of samples -n = 100 - -# Create precomputed kernel matrices -# In practice, these would be computed from your actual data -H1 = np.random.rand(n, n) -H2 = np.random.rand(n, n) -H3 = np.random.rand(n, n) -H4 = np.random.rand(n, n) -H5 = np.random.rand(n, n) -H6 = np.random.rand(n, n) - -tensors = [H1, H2, H3, H4, H5, H6] -expression = "ab,bc,cd,de,ef,fg->" - -# Compute the U-statistic -result = ustat(tensors=tensors, expression=expression, average=True) -print(f"7th-order U-statistic: {result}") - -# You can also compute the unaveraged sum -sum_result = ustat(tensors=tensors, expression=expression, average=False) -print(f"Sum (before averaging): {sum_result}") -``` - - - -## 4. API Reference - -### 4.1 Main Functions - -#### `ustat(tensors, expression, average=True, optimize="greedy", **kwargs)` -Compute U-statistics from input tensors. - -**Parameters:** -- `tensors` (List[np.ndarray]): List of input tensors (numpy arrays or torch tensors) -- `expression` (str | List | Tuple): Tensor contraction expression - - String format: Einstein summation notation (e.g., "ij,jk->ik") - - List format: Nested indices (e.g., [[1,2],[2,3]]) -- `average` (bool, default=True): Whether to compute average (True) or sum (False) -- `optimize` (str, default="greedy"): Optimization strategy for tensor contraction - - "greedy": Fast heuristic optimization - - "optimal": Exhaustive search for optimal contraction order - - "dp": Dynamic programming approach -- `**kwargs`: Additional keyword arguments passed to `opt_einsum.contract` - -**Returns:** -- `float`: Computed U-statistic value - -**Example:** -```python -result = ustat([H1, H2], "ij,jk->", average=True, optimize="optimal") -``` - -#### `vstat(tensors, expression, average=True, optimize="greedy", **kwargs)` -Compute V-statistics from input tensors. - -**Parameters:** Same as `ustat` - -**Returns:** Computed V-statistic value - -#### `set_backend(backend_name)` -Set the tensor computation backend. - -**Parameters:** -- `backend_name` (str): Backend identifier - - `"numpy"`: Use NumPy backend - - `"torch"`: Use PyTorch backend - -**Example:** -```python -set_backend("torch") # Switch to PyTorch backend -``` - -#### `get_backend()` -Get the current tensor computation backend. - -**Returns:** -- `str`: Current backend name ("numpy" or "torch") - -### 4.2 Classes - -#### `UStats(expression)` -Class-based interface for U-statistics computation with advanced features. - -**Parameters:** -- `expression`: Tensor contraction expression (same format as function interface) - -**Methods:** -- `compute(tensors, average=True, **kwargs)`: Compute U-statistic -- `complexity_analysis()`: Analyze computational complexity -- `get_contraction_path()`: Get optimized contraction path - -**Example:** -```python -ustats_obj = UStats("ij,jk->") -result = ustats_obj.compute([H1, H2], average=True) -complexity = ustats_obj.complexity_analysis() -``` - -#### `VStats(expression)` -Class-based interface for V-statistics computation with advanced features. -**Parameters and Methods:** Same as `UStats` +## Requirements -#### `U_stats_loop(expression)` -Reference implementation using explicit loops (for validation and small computations). +- Python 3.11+ +- NumPy ≥ 1.20.0 +- opt_einsum ≥ 3.3.0 -**Note:** This class is primarily for testing and educational purposes. Use `UStats` for production code. +## License -## 5. Changelog +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. -See [CHANGELOG.md](CHANGELOG.md) for detailed version history and changes. +## Contributing -## 6. License +Contributions are welcome! Please feel free to submit a Pull Request. -This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details. + diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..38dad69 --- /dev/null +++ b/readme.md @@ -0,0 +1,286 @@ +# U-Statistics-python `u-stats` +[![PyPI version](https://badge.fury.io/py/u-stat.svg)](https://badge.fury.io/py/u-stats) +[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Build Status](https://img.shields.io/github/actions/workflow/status/Amedar-Asterisk/U-Statistics-python/ci.yml?branch=main)](https://github.com/Amedar-Asterisk/U-Statistics-python/actions) + +**U-statistics** are fundamental tools in statistics, probability theory, theoretical computer science, economics, statistical physics, and machine learning. Named after Wassily Hoeffding, U-statistics provide unbiased estimators for population parameters and form the foundation for many statistical tests and methods. However, computing U-statistics can be computationally demanding, especially for high-order cases where the number of combinations grows exponentially. + +This package provides a high-performance, tensor-based implementation for computing U-statistics and V-statistics with significant computational advantages: + +- Leverages the underlying combinatorial structure of kernel functions to significantly reduce computational complexity from exponential to polynomial in many cases +- Utilizes optimized einsum engines—[`numpy.einsum`](https://numpy.org/doc/stable/reference/generated/numpy.einsum.html) and [`torch.einsum`](https://pytorch.org/docs/stable/generated/torch.einsum.html)—to enable efficient computation on both CPU and GPU + +## Table of Contents + +1. [Installation](#1-installation) +2. [Requirements](#2-requirements) +3. [Example Usage](#3-example-usage) +4. [API Reference](#4-api-reference) +5. [Changelog](#7-changelog) +6. [License](#8-license) +7. [Contributing](#9-contributing) + +## 1. Installation + +Install the package from PyPI: + +```bash +pip install u-stats +``` + +For development installation: + +```bash +git clone https://github.com/Amedar-Asterisk/U-Statistics-python.git +cd U-Statistics-python +pip install -e . +``` + +## 2. Requirements + +### Required Dependencies +- **Python 3.11+** +- **NumPy >= 1.20.0** +- **opt_einsum >= 3.3.0** + +### Optional Dependencies +- **torch >= 1.9.0**: GPU acceleration and parallel CPU computation + +## 3. Example Usage + +### 3.1 Selection of Backend + +The package supports two computation backends for different performance needs: + +```python +from u_stats import set_backend, get_backend + +# Set backend to NumPy (default) +set_backend("numpy") # CPU computation, deterministic results + +# Set backend to PyTorch (optional) +set_backend("torch") # GPU acceleration and parallel CPU computation + +# Check current backend +current_backend = get_backend() +print(f"Current backend: {current_backend}") +``` + +### 3.2 Computing U-statistics + +[`ustat`](https://github.com/Amedar-Asterisk/U-Statistics-python/blob/main/src/u_stats/__init__.py#L92-L131) is the main function for computing U-statistics. + +Here we take a **7th-order U-statistic** with kernel function + +$$ +h(x_1,x_2,\dots,x_7) = h_1(x_1, x_2) h_2(x_2, x_3) \dots h_6(x_6, x_7) +$$ + +as an example. For samples $X = (X_1, \dots, X_n)$, the U-statistic takes the form + +$$ +U = \frac{1}{n(n-1)\cdots (n-6)} \sum_{(i_1,\dots,i_7) \in P_7}h_1(X_{i_1},X_{i_2})\cdots h_6(X_{i_6},X_{i_7}) +$$ + +where $P_7$ denotes all 7-tuples of distinct indices. + +#### 3.2.1 Tensor Assembly + +We assume that the kernel function values on samples $X$ have been precomputed and assembled into matrices $H_1, H_2, \dots, H_6 \in \mathbb{R}^{n \times n}$: + +$$ +H_k[i,j] = h_k(X_i, X_j) +$$ + +#### 3.2.2 Expression Formats + +The expression defines how kernel matrices are connected in the computation. We take this U-statistic as an example to explain how to construct expression. + +to express the structure of the kernel function $h(x_1, x_2, \dots, x_7) = h_1(x_1, x_2) \cdot h_2(x_2, x_3) \cdots h_{6}(x_{6}, x_7)$, we assign a unique index to each distinct variable $x_1, x_2, \dots, x_7$. For each factor $h_k(x_{k}, x_{k+1})$, we collect the indices of the variables it depends on into a pair. The sequence of pairs is then ordered according to the order of the factors in the product. + +We can using the following notation to represent this structure: + +**Einstein Summation Notation:** +```python +expression = "ab,bc,cd,de,ef,fg->" +``` + +**Nested List Notation:** +```python +expression = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] +``` + +**Format Explanation:** +- In Einstein notation: each letter represents an index, each string like `"ab"` represents a factor of the kernel +- In list notation: each sub-list `[i,j]` represents a factor of the kernel +Both formats are equivalent and specify the same computation pattern. + +#### 3.2.3 Complete Example + +```python +from u_stats import ustat, set_backend +import numpy as np + +# Choose computation backend +set_backend("torch") # Use torch if available +# The default is numpy + + +# Set number of samples +n = 100 + +# Create precomputed kernel matrices +# In practice, these would be computed from your actual data +H1 = np.random.rand(n, n) +H2 = np.random.rand(n, n) +H3 = np.random.rand(n, n) +H4 = np.random.rand(n, n) +H5 = np.random.rand(n, n) +H6 = np.random.rand(n, n) + +tensors = [H1, H2, H3, H4, H5, H6] +expression = "ab,bc,cd,de,ef,fg->" + +# Compute the U-statistic +result = ustat(tensors=tensors, expression=expression, average=True) +print(f"7th-order U-statistic: {result}") + +# You can also compute the unaveraged sum +sum_result = ustat(tensors=tensors, expression=expression, average=False) +print(f"Sum (before averaging): {sum_result}") +``` + + + +## 4. API Reference + +### 4.1 Main Functions + +#### `ustat(tensors, expression, average=True, optimize="greedy", **kwargs)` +Compute U-statistics from input tensors. + +**Parameters:** +- `tensors` (List[np.ndarray]): List of input tensors (numpy arrays or torch tensors) +- `expression` (str | List | Tuple): Tensor contraction expression + - String format: Einstein summation notation (e.g., "ij,jk->ik") + - List format: Nested indices (e.g., [[1,2],[2,3]]) +- `average` (bool, default=True): Whether to compute average (True) or sum (False) +- `optimize` (str, default="greedy"): Optimization strategy for tensor contraction + - "greedy": Fast heuristic optimization + - "optimal": Exhaustive search for optimal contraction order + - "dp": Dynamic programming approach +- `**kwargs`: Additional keyword arguments passed to `opt_einsum.contract` + +**Returns:** +- `float`: Computed U-statistic value + +**Example:** +```python +result = ustat([H1, H2], "ij,jk->", average=True, optimize="optimal") +``` + +#### `vstat(tensors, expression, average=True, optimize="greedy", **kwargs)` +Compute V-statistics from input tensors. + +**Parameters:** Same as `ustat` + +**Returns:** Computed V-statistic value + +#### `set_backend(backend_name)` +Set the tensor computation backend. + +**Parameters:** +- `backend_name` (str): Backend identifier + - `"numpy"`: Use NumPy backend + - `"torch"`: Use PyTorch backend + +**Example:** +```python +set_backend("torch") # Switch to PyTorch backend +``` + +#### `get_backend()` +Get the current tensor computation backend. + +**Returns:** +- `str`: Current backend name ("numpy" or "torch") + +### 4.2 Classes + +#### `UStats(expression)` +Class-based interface for U-statistics computation with advanced features. + +**Parameters:** +- `expression`: Tensor contraction expression (same format as function interface) + +**Methods:** +- `compute(tensors, average=True, **kwargs)`: Compute U-statistic +- `complexity_analysis()`: Analyze computational complexity +- `get_contraction_path()`: Get optimized contraction path + +**Example:** +```python +ustats_obj = UStats("ij,jk->") +result = ustats_obj.compute([H1, H2], average=True) +complexity = ustats_obj.complexity_analysis() +``` + +#### `VStats(expression)` +Class-based interface for V-statistics computation with advanced features. + +**Parameters and Methods:** Same as `UStats` + +#### `U_stats_loop(expression)` +Reference implementation using explicit loops (for validation and small computations). + +**Note:** This class is primarily for testing and educational purposes. Use `UStats` for production code. + +## 5. Changelog + +See [CHANGELOG.md](CHANGELOG.md) for detailed version history and changes. + +## 6. License + +This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details. + +## 7. Contributing + +We welcome contributions! Here's how you can help: + +### Reporting Issues +- Use the [GitHub issue tracker](https://github.com/Amedar-Asterisk/U-Statistics-python/issues) +- Include minimal reproducible examples +- Specify your environment (Python version, OS, backend) + +### Development Setup +```bash +# Clone the repository +git clone https://github.com/Amedar-Asterisk/U-Statistics-python.git +cd U-Statistics-python + +# Install in development mode +pip install -e ".[test]" +``` + +### Pull Requests +- Fork the repository and create a feature branch +- Add tests for new functionality +- Ensure all tests pass and type checking succeeds +- Update documentation as needed +- Follow the existing code style + +For questions or discussions, feel free to open an issue or reach out to the maintainers. + + From cf33e8fca457eb1b38caf469b97de4b7dfc1b580 Mon Sep 17 00:00:00 2001 From: zrq <110216590+Amedar-Asterisk@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:20:33 +0800 Subject: [PATCH 2/6] Delete README.md --- README.md | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 306f7df..0000000 --- a/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# U-Statistics Python Package - -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) - -A Python package for efficient computation of U-statistics and V-statistics via tensor contraction. - -## Features - -- Efficient computation of U-statistics and V-statistics -- Support for multiple tensor backends (NumPy and PyTorch) -- Both high-level convenience functions and low-level class interfaces -- Optimized tensor operations using `opt_einsum` - -## Installation - -```bash -pip install u-stats -``` - -## Requirements - -- Python 3.11+ -- NumPy ≥ 1.20.0 -- opt_einsum ≥ 3.3.0 - -## License - -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. - -## Contributing - -Contributions are welcome! Please feel free to submit a Pull Request. - - From 0f71ea57fbcf21e3ae6599aca16ab35e8cf7bd7f Mon Sep 17 00:00:00 2001 From: zrq <110216590+Amedar-Asterisk@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:22:00 +0800 Subject: [PATCH 3/6] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 38dad69..5e01225 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,7 @@ This package provides a high-performance, tensor-based implementation for computing U-statistics and V-statistics with significant computational advantages: -- Leverages the underlying combinatorial structure of kernel functions to significantly reduce computational complexity from exponential to polynomial in many cases +- Leverages the underlying combinatorial structure of kernel functions to significantly reduce computational complexity in many cases - Utilizes optimized einsum engines—[`numpy.einsum`](https://numpy.org/doc/stable/reference/generated/numpy.einsum.html) and [`torch.einsum`](https://pytorch.org/docs/stable/generated/torch.einsum.html)—to enable efficient computation on both CPU and GPU ## Table of Contents @@ -97,7 +97,7 @@ $$ The expression defines how kernel matrices are connected in the computation. We take this U-statistic as an example to explain how to construct expression. -to express the structure of the kernel function $h(x_1, x_2, \dots, x_7) = h_1(x_1, x_2) \cdot h_2(x_2, x_3) \cdots h_{6}(x_{6}, x_7)$, we assign a unique index to each distinct variable $x_1, x_2, \dots, x_7$. For each factor $h_k(x_{k}, x_{k+1})$, we collect the indices of the variables it depends on into a pair. The sequence of pairs is then ordered according to the order of the factors in the product. +To express the structure of the kernel function $h(x_1, x_2, \dots, x_7) = h_1(x_1, x_2) \cdot h_2(x_2, x_3) \cdots h_{6}(x_{6}, x_7)$, we assign a unique index to each distinct variable $x_1, x_2, \dots, x_7$. For each factor $h_k(x_{k}, x_{k+1})$, we collect the indices of the variables it depends on into a pair. The sequence of pairs is then ordered according to the order of the factors in the product. We can using the following notation to represent this structure: From 1a10a864f50249803db9ecdb0a53a6d3664eb156 Mon Sep 17 00:00:00 2001 From: zrq <110216590+Amedar-Asterisk@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:22:22 +0800 Subject: [PATCH 4/6] Rename readme.md to README.md --- readme.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename readme.md => README.md (100%) diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md From 0447c9508755e7b7692d2beef2471b1e2b30384c Mon Sep 17 00:00:00 2001 From: ZRQ Date: Fri, 4 Jul 2025 19:23:45 +0800 Subject: [PATCH 5/6] =?UTF-8?q?bump:=20version=200.7.3=20=E2=86=92=200.7.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 8 ++++++++ pyproject.toml | 4 ++-- src/u_stats/__init__.py | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd7181e..061cf3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.7.4 (2025-07-04) + +### Fix + +- allow string input for expression parameter in U_stats_loop function +- improve formatting and readability of backend documentation in _backend.py +- update citation section in README.md to be commented out and adjust version reference format in pyproject.toml + ## 0.7.3 (2025-07-04) ### Fix diff --git a/pyproject.toml b/pyproject.toml index 3907d3c..2cdafc1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "u-stats" -version = "0.7.3" +version = "0.7.4" authors = [ {name = "Ruiqi Zhang", email = "zrq1706@outlook.com"} ] @@ -106,7 +106,7 @@ ignore_missing_imports = true name = "cz_conventional_commits" tag_format = "$version" version_scheme = "semver" -version = "0.7.3" +version = "0.7.4" version_files = [ "pyproject.toml:version", "src/u_stats/__init__.py:__version__", diff --git a/src/u_stats/__init__.py b/src/u_stats/__init__.py index dfd07cb..480eea4 100644 --- a/src/u_stats/__init__.py +++ b/src/u_stats/__init__.py @@ -25,7 +25,7 @@ """ __title__ = "u_stats" -__version__ = "0.7.3" +__version__ = "0.7.4" __description__ = "A Python package for efficient computation of U-statistics via tensor contraction." # noqa: E501 __author__ = "Zhang Ruiqi" __author_email__ = "zrq1706@outlook.com" From f9005022ad675b20add4e21aeb864b2ac8fed328 Mon Sep 17 00:00:00 2001 From: zrq <110216590+Amedar-Asterisk@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:27:51 +0800 Subject: [PATCH 6/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e01225..bcbe94b 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ The expression defines how kernel matrices are connected in the computation. We To express the structure of the kernel function $h(x_1, x_2, \dots, x_7) = h_1(x_1, x_2) \cdot h_2(x_2, x_3) \cdots h_{6}(x_{6}, x_7)$, we assign a unique index to each distinct variable $x_1, x_2, \dots, x_7$. For each factor $h_k(x_{k}, x_{k+1})$, we collect the indices of the variables it depends on into a pair. The sequence of pairs is then ordered according to the order of the factors in the product. -We can using the following notation to represent this structure: +We can use the following notation to represent this structure: **Einstein Summation Notation:** ```python @@ -114,7 +114,7 @@ expression = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] **Format Explanation:** - In Einstein notation: each letter represents an index, each string like `"ab"` represents a factor of the kernel - In list notation: each sub-list `[i,j]` represents a factor of the kernel -Both formats are equivalent and specify the same computation pattern. +Both formats are equivalent and specify the same computation pattern in our package #### 3.2.3 Complete Example