The repository or configuration that created this release differ from a previous release. View details.
This release is a pre-release and may not be stable for production use.
seminal is a Python library of published risk equations in andrology and male reproductive health, implemented with the coefficients exactly as printed in the source papers and checked against the authors' own validation data.
The first release implements the two azoospermia prediction models of Tradewell et al. (World J Mens Health 2022): a quadratic in serum FSH alone, and a logistic regression on age, FSH, LH, total testosterone and mean testis volume. Both estimate the probability that a man presenting for infertility evaluation has no sperm in the ejaculate, without a semen analysis.
Not affiliated with the original authors. This is an independent implementation of published equations, intended for research use. It is not a medical device and should not be used to make clinical decisions.
Installation
pip install seminal
Requires Python 3.8+, numpy 1.20+ and pandas 1.3+. Full documentation: datasciencedynamics.com/seminal.
Usage
FSH alone
from seminal import azoospermia_fsh
azoospermia_fsh(20)
# 0.439
The published curve is U-shaped: 10.1% at undetectable FSH, a minimum of about 8.4% at FSH 3.6 IU/L, and 100% from about 30 IU/L. Output is clipped to [0, 1]; pass clip=False to reproduce the paper's unbounded quadratic.
Full logistic model
from seminal import azoospermia_lr
azoospermia_lr(age=36, fsh=5.7, lh=4.5, testosterone=429, testis_volume=15)
# 0.086
Pass explain=True to also get the linear predictor and each input's contribution to the log-odds, largest first.
A whole cohort
from seminal import add_azoospermia_risk_cols
scored = add_azoospermia_risk_cols(
df, age_col="age", fsh_col="fsh", lh_col="lh",
testosterone_col="testosterone", testis_volume_col="testis_volume",
)
scored[["azoo_fsh", "azoo_lr"]]
Rows missing any logistic-model input get NaN in azoo_lr; azoo_fsh needs only FSH.
The equations
FSH-only quadratic (Fig. 1): p(%) = 0.133·FSH² − 0.965·FSH + 10.1, fit to binned Miami probabilities, R² = 0.95.
Logistic regression (Table 3): p = 1 / (1 + exp(−η)) where
| Term | Units | Coefficient |
|---|---|---|
| Intercept | −1.9 | |
| Age | years | 0.02 |
| FSH | IU/L | 0.13 |
| LH | IU/L | 0.03 |
| Total testosterone | ng/dL | −0.002 |
| Mean testis volume | cm³ (Prader orchidometer) | −0.08 |
The paper prints the model form as 1/exp[−(b₀ + bᵢXᵢ)], which is a typesetting error (it exceeds 1); the standard logistic form is used here.
Validation against the authors' data
The study data are public under CC0 on Harvard Dataverse. make data_gen preprocess downloads them into data/ (gitignored) and the test suite then checks the implementation against the paper's external validation:
| Site | n | AUC, logistic (paper) | AUC, FSH-only (paper) |
|---|---|---|---|
| Milan | 1,955 | 0.786 (0.79) | 0.786 (0.78) |
| Chicago | 596 | 0.718 (0.72) | 0.707 (0.71) |
Things to know about the data
- The deposit contains all three sites as separate sheets. Miami (1,070 rows) and Chicago (643) are pre-exclusion. Applying the exclusions exactly as the paper states them (prior vasectomy, Y microdeletion, solitary testis, testosterone or steroid use) gives 943 and 614, not the paper's 946 and 596. The paper's counts are recovered exactly by not excluding Y microdeletions, reading solitary testis from the absence codes (Miami) or a zero volume (Chicago), and defining azoospermia as concentration below 0.01 M/mL.
preprocessing.pyapplies that reproduced rule by default (--exclusions statedgives the literal one); the choice does not change the AUCs. Milan (1,955) matches either way. - Chicago testis volumes are ultrasound long-axis measurements in cm (median 4.5), not orchidometer volumes in mL (median 14 to 15 at Miami and Milan). The paper does not address this;
preprocessing.pylabels the measurement method per site. - The logistic coefficients are printed to one or two significant figures. At the extremes of testosterone and age this rounding alone can move the log-odds by several tenths. A refit on the Miami data recovers full-precision values; that is planned for a later release and kept separate from the as-published model.
- Azoospermia was confirmed on at least two semen analyses. The outcome in the Miami and Chicago sheets is sperm concentration = 0; Milan carries an explicit flag plus obstructive/non-obstructive type.
Notebooks
00_quickstart.ipynb: one patient, the FSH curve, scoring the validation cohorts, ROC / PR / calibration per site, explaining a prediction.01_reproduce_tradewell.ipynb: rebuild the paper's cohort and Table 1 from the deposit, refit the logistic model on Miami, calibration-in-the-large and slope per site, decision curves, intercept-only recalibration.
Both run against data/processed/, built by make data_gen preprocess. Notebooks are committed without outputs; the rendered versions are on the documentation site.
Repository layout
seminal/
├── src/seminal/ the package (equations only; no data)
├── tests/ unit tests plus optional validation against data/
├── data_gen.py download the Dataverse file into data/raw
├── preprocessing.py harmonize sites into data/processed
├── notebooks/ quickstart and the reproduction of Tradewell et al.
└── Makefile venv, install, test, data_gen, preprocess, build
Citation
If you use seminal, please cite the software (see CITATION.cff) and the original paper:
Tradewell MB, Cazzaniga W, Pagani RL, et al. Algorithms for Predicting the Probability of Azoospermia from Follicle Stimulating Hormone: Design and Multi-Institutional External Validation. World J Mens Health. 2022;40(4):600-607. doi:10.5534/wjmh.210138
License
MIT. The study data on Dataverse are CC0.
Author
Leonid Shpaner, University of San Diego and Data Science Dynamics. leonshpaner.com
Metadata
Release files for seminal 0.0.0a3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| seminal-0.0.0a3.tar.gz | 13.5 kB | With provenance | Details for seminal-0.0.0a3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seminal-0.0.0a3-py3-none-any.whl | Python 3 | none | any | Details for seminal-0.0.0a3-py3-none-any.whl |
Total release size: 23.2 kB
Release files / seminal-0.0.0a3.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | seminal-0.0.0a3.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10f6108cf857e41c815c4c014662da77c571192345fc5f1a5f59c507cc9425ef
|
|
BLAKE2b-256 checksum How to use checksums |
8c4b270d463444b4448b53c2ffbcc7671b661779046532f8e79492547e3f603f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logRelease files / seminal-0.0.0a3-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | seminal-0.0.0a3-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95d31343ba538fcd3d6ef6930667ce4193dcff72b81382459c2498e6633efec6
|
|
BLAKE2b-256 checksum How to use checksums |
f883935a1f352cc818d687097b58896ba5698da3ad0fcc2ae5b343d020c463b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logSecurity for seminal 0.0.0a3
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.
Change of provenance
The repository and configuration that created this release differ from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Repository
- Removed 0.0.0a2 github.com/lshpaner/seminal
- Added 0.0.0a3 github.com/datasciencedynamics/seminal
Attestation for seminal-0.0.0a3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Transparency logA 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.