Geometric Sampling Method - Python Package
The Geometric Sampling Method, introduced by Panahbehagh (2024), presents an innovative approach to finite population sampling based on a unique geometric framework. This method allows researchers to visually depict first-order inclusion probabilities (FIP) as bars on a two-dimensional graph. By adjusting the positions of these bars, users can explore a wide range of sampling designs while controlling second-order inclusion probabilities (SIP).
This package, geometric_sampling, provides tools for implementing the Geometric Sampling Method and is available on PyPI.
Features
- Create various unequal probability sampling designs with a fixed FIP.
- Control and explore second-order inclusion probabilities (SIP) through visual manipulation.
- Incorporate search algorithms, such as A* and Genetic Algorithm, to optimize sampling designs for specific needs (e.g., well-spread or optimal sampling).
Installation
Install the package via pip:
pip install geometric_sampling
How to Use
The package includes core classes and methods to facilitate sampling design creation and optimization. Below is a basic example demonstrating the API.
Example Usage
import geometric_sampling as gm
import numpy as np
# Set up random generator and sample data
rng = np.random.default_rng()
N = 50 # Population size
x = rng.random(size=N) # Auxiliary variable
n = 5 # Sample size
# Generate initial inclusion probabilities
inclusion = rng.random(N)
inclusion *= n / inclusion.sum()
# Define initial sampling design and evaluation criteria
initial_design = gm.Design(inclusion)
nht = gm.criteria.VarNHT(x, inclusion)
astar = gm.search.AStar(initial_design, nht, switch_coefficient=1)
# Display initial criteria and design
print("Initial criteria value:", astar.initial_criteria_value)
astar.initial_design.show()
# Run the A* search algorithm to optimize the design
astar.run(max_iterations=2000, num_new_nodes=10, max_open_set_size=10000, num_changes=1)
# Display results after optimization
print("Best criteria value:", astar.best_criteria_value)
astar.best_design.show()
Maintainers
- Bardia Panahbehagh - bardia.panah@gmail.com
- Mehdi Mohebbi - mehdi.mohebbi23@gmail.com
- AmirMohammad HosseiniNasab - awmirhn@gmail.com
- Mehdi Hosseini Moghadam - m.h.moghadam1996@gmail.com
For more details, consult the official paper: Panahbehagh, B. (2024). Geometric Sampling Method.
Metadata
Release files for geometric-sampling 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| geometric_sampling-0.4.3.tar.gz | 774.8 kB | Without provenance | Details for geometric_sampling-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| geometric_sampling-0.4.3-py3-none-any.whl | Python 3 | none | any | Details for geometric_sampling-0.4.3-py3-none-any.whl |
Total release size: 799.8 kB
Release files / geometric_sampling-0.4.3.tar.gz
| Download URL | geometric_sampling-0.4.3.tar.gz |
|---|---|
| Size | 774.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58f79b9ded1fd2220ce4c8aeec3f0744b71e5aa38d31b3de6137e5099343c95b
|
|
BLAKE2b-256 checksum How to use checksums |
18836ab5dc86dffa422ee745bf3d88f4f1a7e224eccb04499e6b521f77ec86b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / geometric_sampling-0.4.3-py3-none-any.whl
| Download URL | geometric_sampling-0.4.3-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b297afa8f449e5735b02b6d8b093457a85f77c3b7a1552cd4385806a55721498
|
|
BLAKE2b-256 checksum How to use checksums |
f30f78e771c426a9b12b42484591ba5866eeff9600e205c8562e522bdde930a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for geometric-sampling 0.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.