Sample Things EVENly
Project description
Steven
Steven (Sample Things EVENly) helps you sample your data in nice easy ways, evenly across the range of the data!
How to use Steven
The main method of steven is subset_data_evenly. This takes as input a sequence-liked object such as a list, tuple, np.ndarray or pd.Series, and samples it in such a way that the items returned represent a balanced distribution across the data range.
This is useful for balancing data for machine learning applications, among other things!
Here is an example that you can run:
import numpy as np
import matplotlib.pyplot as plt
from steven.subsets import subset_data_evenly
# Create some data...
data = np.exp(np.random.rand(100_000))
plt.hist(data, bins=50, range=[data.min(), data.max()], label='All data')
# Now sample the data...
data_sampled = subset_data_evenly(data, n_bins=50, sample_size=20_000)
plt.hist(data_sampled, bins=50, range=[data.min(), data.max()], label='Sampled')
plt.legend()
plt.show()
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file steven-0.2.1.tar.gz.
File metadata
- Download URL: steven-0.2.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9220fbb0bedab44f7a69b1f59643cdf61e5c35ac8b565a8927ae52352ffa9986
|
|
| MD5 |
1801de0bad8ce9ff88255d400a173dcf
|
|
| BLAKE2b-256 |
36ab662d1de22bfc84f45fd3e9a044ff706345bf59a06956c35b25b69f9dee2d
|
File details
Details for the file steven-0.2.1-py3-none-any.whl.
File metadata
- Download URL: steven-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
867cfc80aaa96fb220360c4518cd3b081d15ba6bb3066515f94844e7d9bdc03d
|
|
| MD5 |
08b5bf87099c1a601a6463491d0f1696
|
|
| BLAKE2b-256 |
3b1922907e06f25613dbd09f4f4ca4c095e0f39d77e4cd8eb9c8e37c5509d4fc
|