Python package for Geometric Sampling Method
Project description
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(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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file geometric_sampling-0.3.0.tar.gz
.
File metadata
- Download URL: geometric_sampling-0.3.0.tar.gz
- Upload date:
- Size: 179.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.29
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22aa0b07c1b991426cdd5983b1d29077fa2452ce1e7b3843737486553f343567 |
|
MD5 | c8d867bfb21354922aab288416b607de |
|
BLAKE2b-256 | 5a18954d6b7b5ed8843da18b01c38222e1a6d80a75359e0d086281078ea7b37f |
File details
Details for the file geometric_sampling-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: geometric_sampling-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.29
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcfe3f9601ebb700323d6f575961e843b2b936f952de84a7e6ab8b4b4ea18f68 |
|
MD5 | 51ab9deb7b2877390f32c5499f03e6dd |
|
BLAKE2b-256 | 9045a75ac568f10388400757de2e895e251dbc15e893680339291096193cdd38 |