Skip to main content

entropytree

A decision tree classifier written from scratch in pure Python (standard library only, no NumPy or other dependencies) using Shannon entropy and information gain.

pip install sai-entropytree
from entropytree import DecisionTree

X = [[2.0, 1.0], [3.0, 1.5], [6.0, 4.0], [7.0, 4.5], [8.0, 5.0]]
y = ["small", "small", "big", "big", "big"]

tree = DecisionTree(max_depth=2).fit(X, y)
print(tree.predict([[2.5, 1.2], [7.5, 4.8]]))   # ['small', 'big']
print(tree.score(X, y))                          # 1.0
tree.display(["length", "width"])

Hyperparameters

  • max_depth – size of the tree (default None = grow until pure)
  • min_samples_split – minimum samples needed to split a node
  • min_gain – minimum information gain to accept a split

API

fit(X, y), predict(X), score(X, y), get_depth(), export_text(feature_names), display(feature_names)

Metadata

Release files for sai-entropytree 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sai-entropytree 0.2.0
File Size Uploaded Provenance
sai_entropytree-0.2.0.tar.gz 4.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sai-entropytree 0.2.0
File Interpreter ABI Platform
sai_entropytree-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / sai_entropytree-0.2.0.tar.gz

Download URL sai_entropytree-0.2.0.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
58e600cae3cc9b84e6799d122ee484e0bbd1d25a518d68f84c82543bea05b899
BLAKE2b-256 checksum
How to use checksums
2c5399105fab2098faf63a3b849e25a8c5f9aeabf3534451981b7d825afb942e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / sai_entropytree-0.2.0-py3-none-any.whl

Download URL sai_entropytree-0.2.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a32b7be99355e3fcb8e95203278022b2a32795e4a10dbbc28f531a1024c54d4d
BLAKE2b-256 checksum
How to use checksums
a7bdf4c38285ae0a8d2ee16aaf0ef7a68daa5f3c6ff040e607f9f2c31a31981e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for sai-entropytree 0.2.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page