PyOccam
Python bindings for OCCAM Reconstructability Analysis
What is PyOccam?
PyOccam wraps the OCCAM Reconstructability Analysis tools in a modern Python package. It provides information-theoretic modeling for categorical data, useful for:
- Environmental modeling (landslides, wildfires)
- Biomedical research (disease risk factors)
- Social science and survey analysis
- Any domain with discrete/categorical variables
OCCAM discovers significant variable relationships while emphasizing interpretability over black-box prediction.
Installation
pip install pyoccam
Quick Start
import pyoccam
# Load built-in dataset
data = pyoccam.load_dementia()
print(f"Loaded {data.n_samples} samples, {data.n_features} features")
# Run search to find best model
manager = data.manager
report = manager.generate_search_report("loopless-up", levels=5, width=3)
print(report)
# Get best model by BIC
best = manager.get_best_model_by_bic()
print(f"Best model: {best}")
# Generate fit report with confusion matrix
fit_report = manager.generate_fit_report(best, target_state="0")
print(fit_report)
# Get confusion matrix as dictionary
cm = manager.get_confusion_matrix(best, target_state="0")
print(f"Accuracy: {cm['train_accuracy']:.1%}")
Convert Your Own CSV Data
import pyoccam
# Convert CSV to OCCAM format with train/test split
output_file, data = pyoccam.make_occam_input_from_csv(
"mydata.csv",
test_split=0.2, # 20% held out for validation
random_state=42, # Reproducible split
max_cardinality=20, # Exclude columns with >20 unique values
dv_column="target", # Specify dependent variable
exclude_columns=["ID", "Name"] # Always exclude these
)
# Analyze - now with train AND test metrics!
best = data.quick_search()
cm = data.manager.get_confusion_matrix(best, target_state="0")
print(f"Train accuracy: {cm['train_accuracy']:.1%}")
print(f"Test accuracy: {cm['test_accuracy']:.1%}")
Or from the command line:
# With 20% test split
python -m pyoccam csv2occam mydata.csv --test-split 0.2 --exclude ID,Name
Model Selection Methods
# Different criteria for "best" model:
best_bic = manager.get_best_model_by_bic() # Most parsimonious (recommended)
best_aic = manager.get_best_model_by_aic() # Less penalty for complexity
best_info = manager.get_best_model_by_information() # Highest info, alpha < 0.05
Built-in Datasets
data = pyoccam.load_dementia() # Alzheimer's disease risk factors
data = pyoccam.load_landslides() # Geological hazard data
data = pyoccam.load_data("file.txt") # Any OCCAM format file
Search Types
"loopless-up"- Bottom-up search, no feedback loops (recommended for directed systems)"loopless-down"- Top-down search, no loops"full-up"- Bottom-up with loops allowed"full-down"- Top-down with loops allowed
Links
- Practical Guide: PRACTICAL_GUIDE.md - Tips from real projects
- OCCAM Manual: PDF - Complete theory & reference
- Source Code: github.com/occam-ra/occam
- Web Interface: occam.hsd.pdx.edu
License
GPL v3 - See LICENSE file
Credits
OCCAM was developed at Portland State University by Prof. Martin Zwick and contributors including Ken Willett, Joe Fusion, and H. Forrest Alexander. Python bindings by David Percy.
Metadata
Release files for pyoccam 0.9.6
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 |
|---|---|---|---|---|
| pyoccam-0.9.6.tar.gz | 1.1 MB | Without provenance | Details for pyoccam-0.9.6.tar.gz |
Built distributions (wheels)
Total release size: 28.0 MB
Release files / pyoccam-0.9.6.tar.gz
| Download URL | pyoccam-0.9.6.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00c60976c01f044085dcd2bb83df747c20be810b0de608d5f9eac41c9167a955
|
|
BLAKE2b-256 checksum How to use checksums |
bf05d4d2a94c8ff843576e392ee54816d0922a3ddec55ecd34bd577b593394bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp312-cp312-win_amd64.whl
| Download URL | pyoccam-0.9.6-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
338ac54838aad717b4c85cc0f19c3f76de5fabe22ad58b21e243b69cbdf71b23
|
|
BLAKE2b-256 checksum How to use checksums |
3195820a48540306aa48285ee37a8c1f0278c782738b714a6e643885db82fc96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoccam-0.9.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a50631296ccb0bba2223065ad981859bc30aa685667ce7dd3ea6c9087aafdd6a
|
|
BLAKE2b-256 checksum How to use checksums |
6be9b751580860384535f29ea2d53a67da58ada41f21fa86d821da8ad678053f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp312-cp312-macosx_10_9_universal2.whl
| Download URL | pyoccam-0.9.6-cp312-cp312-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
7bee5aea95553a761a961089c488ca912952e9ccc203d3de4c1586ca705aaaa6
|
|
BLAKE2b-256 checksum How to use checksums |
3779fe64cf8c1cfa10c19297d87f535285cf142fe33f2c873fd57b75c97da2a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp311-cp311-win_amd64.whl
| Download URL | pyoccam-0.9.6-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b6b66df2b720fa2857796b73e127cf55da608e9a0f4db314e09b529fe6b66274
|
|
BLAKE2b-256 checksum How to use checksums |
d0e3f437f8ef5bf186c184b4c2d8ced4cdfa71de1361771e5c9c300ecd71e951
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoccam-0.9.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7583313ada1527a6c0d4eefcbca98945ebc0c1b3cea001c8a9bbd9d1799c383b
|
|
BLAKE2b-256 checksum How to use checksums |
c48e5bf7a1820706d3c187b4296adb704fe675397e9805879d27f3835326e9bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp311-cp311-macosx_10_9_universal2.whl
| Download URL | pyoccam-0.9.6-cp311-cp311-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
ee5b96ed464d9adad60c1f8eee0df7e097af1b8879240e4d36f6207b92e7904f
|
|
BLAKE2b-256 checksum How to use checksums |
4d19b1df6a5017c60903573882e8ee73f190cefe0075d434a12dde32538a58f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp310-cp310-win_amd64.whl
| Download URL | pyoccam-0.9.6-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
21bcdb92d5b6be721795411d5ecb16bc9cd00f7551ce0fc5d4f9c25741e6f244
|
|
BLAKE2b-256 checksum How to use checksums |
1f22df048b1bbfb49c2a97f60e5f1f6d91448ca87ff43f3fd1aa3897fd72684d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoccam-0.9.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
990e611fc64151d424dbc50db9ede53e8c7162dfc7186bc3ade6318d1cdf167d
|
|
BLAKE2b-256 checksum How to use checksums |
7a0e2f824363bc2adf48c6ce02fe7f10b40ac6bf0f39e765ba33d4f00e89a44c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp310-cp310-macosx_10_9_universal2.whl
| Download URL | pyoccam-0.9.6-cp310-cp310-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
dd8e3aec1e4197f2e4a3cdc14ff69c167def4cf5cb89aaee71edae34e50913f7
|
|
BLAKE2b-256 checksum How to use checksums |
cdf433c1e0bc9fa1f5d4944f92a4e11bcd497a9442a61f1fc1942fe9e07b98cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp39-cp39-win_amd64.whl
| Download URL | pyoccam-0.9.6-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
15495deb8c6f5819ae359423b0c42a2c0ad235bf4bd32dba386a96a2ec251d1e
|
|
BLAKE2b-256 checksum How to use checksums |
f350594f3ac6c44d6d9f74aa6725fa794dde0951640c7474268375fa7fb8c98d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyoccam-0.9.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a973319829d1804ae3b268b167af74f7ea1077f67458580c7f3e716027dc4492
|
|
BLAKE2b-256 checksum How to use checksums |
efba18f2b7b2abd8d384d6a637f82494d0a97270abec7361c898e4725568e537
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyoccam-0.9.6-cp39-cp39-macosx_10_9_universal2.whl
| Download URL | pyoccam-0.9.6-cp39-cp39-macosx_10_9_universal2.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
be6008be70ad041d4c14dd8bb0f43b8097da60115eb3de4e8301ea4b07f50df0
|
|
BLAKE2b-256 checksum How to use checksums |
c4e43e2a3a05df1db27925a4563b199ff94624e69d35b75fde56133dbd682e45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pyoccam 0.9.6
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.