Skip to main content

Traditional and Oblique Decision Tree

Project description

obliquetree

obliquetree is an advanced decision tree implementation designed to provide high-performance and interpretable models. It supports both classification and regression tasks, enabling a wide range of applications. By offering traditional and oblique splits, it ensures flexibility and improved generalization with shallow trees. This makes it a powerful alternative to regular decision trees.

Tree Visualization


Getting Started

obliquetree combines advanced capabilities with efficient performance. It supports oblique splits, leveraging L-BFGS optimization to determine the best linear weights for splits, ensuring both speed and accuracy.

In traditional mode, without oblique splits, obliquetree outperforms scikit-learn in terms of speed and adds support for categorical variables, providing a significant advantage over many traditional decision tree implementations.

When the oblique feature is enabled, obliquetree dynamically selects the optimal split type between oblique and traditional splits. If no weights can be found to reduce impurity, it defaults to an axis-aligned split, ensuring robustness and adaptability in various scenarios.

In very large trees (e.g., depth 10 or more), the performance of obliquetree may converge closely with traditional trees. The true strength of obliquetree lies in their ability to perform exceptionally well at shallower depths, offering improved generalization with fewer splits. Moreover, thanks to linear projections, obliquetree significantly outperform traditional trees when working with datasets that exhibit linear relationships.


Installation

To install obliquetree, use the following pip command:

pip install obliquetree

Using the obliquetree library is simple and intuitive. Here's a more generic example that works for both classification and regression:

from obliquetree import Classifier, Regressor

# Initialize the model (Classifier or Regressor)
model = Classifier(  # Replace "Classifier" with "Regressor" if performing regression
    use_oblique=True,       # Enable oblique splits
    max_depth=2,            # Set the maximum depth of the tree
    n_pair=2,               # Number of feature pairs for optimization
    random_state=42,        # Set a random state for reproducibility
    categories=[0, 10, 32], # Specify which features are categorical
)

# Train the model on the training dataset
model.fit(X_train, y_train)

# Predict on the test dataset
y_pred = model.predict(X_test)

Documentation

For example usage, API details, comparisons with axis-aligned trees, and in-depth insights into the algorithmic foundation, we strongly recommend referring to the full documentation.


Key Features

  • Oblique Splits
    Perform oblique splits using linear combinations of features to capture complex patterns in data. Supports both linear and soft decision tree objectives for flexible and accurate modeling.

  • Axis-Aligned Splits
    Offers conventional (axis-aligned) splits, enabling users to leverage standard decision tree behavior for simplicity and interpretability.

  • Feature Constraints
    Limit the number of features used in oblique splits with the n_pair parameter, promoting simpler, more interpretable tree structures while retaining predictive power.

  • Seamless Categorical Feature Handling
    Natively supports categorical columns with minimal preprocessing. Only label encoding is required, removing the need for extensive data transformation.

  • Robust Handling of Missing Values
    Automatically assigns NaN values to the optimal leaf for axis-aligned splits.

  • Customizable Tree Structures
    The flexible API empowers users to design their own tree architectures easily.

  • Exact Equivalence with scikit-learn
    Guarantees results identical to scikit-learn's decision trees when oblique and categorical splitting are disabled.

  • Optimized Performance
    Outperforms scikit-learn in terms of speed and efficiency when oblique and categorical splitting are disabled:

    • Up to 50% faster for datasets with float columns.
    • Up to 200% faster for datasets with integer columns.

    Performance Comparison (Float)

    Performance Comparison (Integer)


Contributing

Contributions are welcome! If you'd like to improve obliquetree or suggest new features, feel free to fork the repository and submit a pull request.


License

obliquetree is released under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

obliquetree-1.0.5-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

obliquetree-1.0.5-cp313-cp313-musllinux_1_2_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

obliquetree-1.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

obliquetree-1.0.5-cp313-cp313-macosx_15_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

obliquetree-1.0.5-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

obliquetree-1.0.5-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

obliquetree-1.0.5-cp312-cp312-musllinux_1_2_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

obliquetree-1.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

obliquetree-1.0.5-cp312-cp312-macosx_15_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

obliquetree-1.0.5-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

obliquetree-1.0.5-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

obliquetree-1.0.5-cp311-cp311-musllinux_1_2_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

obliquetree-1.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

obliquetree-1.0.5-cp311-cp311-macosx_15_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

obliquetree-1.0.5-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

obliquetree-1.0.5-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

obliquetree-1.0.5-cp310-cp310-musllinux_1_2_x86_64.whl (5.4 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

obliquetree-1.0.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

obliquetree-1.0.5-cp310-cp310-macosx_15_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.10macOS 15.0+ ARM64

obliquetree-1.0.5-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file obliquetree-1.0.5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f38dc6b3fa6be42602d7ba52db639d99e97799a2639c96b467e7bbdfcb377ff0
MD5 dd79bef4cdb23af1716fe8b6f206004b
BLAKE2b-256 f05f9b27e2e8958c52ce0f999f75e53516b46ac905eff2915da041924dbbda8c

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 af983c5de433171a33c6e93b59d83394b63a062be141ad76500bbcb38fe05e99
MD5 f4ca8ad15ef3d8b20c711b32b4481fa8
BLAKE2b-256 81aff4a6d71ec4416740d4e1edc4d7c95b2c7529ef5e4373330e02022b379a62

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bea9050f1d5101bd3943a60678061738d5912febdb006b95e6a7772d947699c9
MD5 1d13ee967e9049ee70e1985fe5a7933c
BLAKE2b-256 b6e81a6211dcb3d2d75a5bfa3eaf2686d2ccf662770dd27bfaf34b5132d6782e

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 9f925d1ea54fb149f0169ee4677e32aab41ed2c984bcd5a21e159491fa94db87
MD5 5947ade6e4fba78c534be361882a87b3
BLAKE2b-256 8a8f68d90abea92e41e3bddfccb2cb0a7e2d2d95a055ecf1d2295564125a8918

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f14b5cfe2bac90adf5bc4b49e79b3b670b59576c58eae104df083ac238e43792
MD5 d60f4599525066dcc5b17e9dffbab215
BLAKE2b-256 4dfb677e2f5a053ee08d03159fb64786b6e0703bdb799f640c11a937564ac184

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 53c25b1cf516175a31b9c7690dfe3f89c3603aa7c489f4542a6dac1eedacd218
MD5 ecab7ed45dee9f9928605768fa5ce700
BLAKE2b-256 bd2eef4795acb6f8b570ba0d9568c65eec46a2a7fb8497315705fec467ede690

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d881c64604f4830a31161c4a18c14e9d56ef5f6f63acf4a8c9eabecf58b0b12a
MD5 fb41da20b3802f7ac98c7ed0a78ec3cc
BLAKE2b-256 3c6326992c0b8e7eeff5428511a1e6c6ef32eaa723474cf46bbb4d418087c0ec

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5c0db63ffb87b954be81fb1618d1bf531f8f1e992a84d443c21ab79412398010
MD5 b938cdc94a3739c5c9086e3fbfc93983
BLAKE2b-256 6439ae9bd05ea8e84511370867fbbae0174ae0227cc4c91351b0e456282c622f

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 dee5054643267a2a6cb6a27f100199177157ccb2cb2616f1f114fe4f0a74f3a8
MD5 888f04ed91e0816566bd5ca0ef47ffd2
BLAKE2b-256 5924f697b600bbc4c6983279b6e8a30145a41a00a4b95f3fc68ca74d59d5b7a1

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 39813f302807200964887b62278dacd9fd2b9c5462414fc173a73f9b2750a202
MD5 a65344afea555401ec47530d7b4fc768
BLAKE2b-256 19294b9dc63b65a7cc50c06c7134a5c3ea2dfdbc6420efa40b545a2a0a83c30d

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 59fde99489a9ff2f875047f149a65c306ce2a7f22e66be8968024bab89984f0f
MD5 986166d7b6d9791bd185684b261b0ef9
BLAKE2b-256 a7df02f752e845b7d6ccfb95832bc964cdc65b911fad372c2c61ad18a65a996b

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3ec17a1d04353693d6002a88e3adbdbd04e5fe9ee4897d455381e40c7d0eaeb2
MD5 0f93ac042a804d4b1d37b3c074c65410
BLAKE2b-256 645b9edce729ea412fcaa554103e2994661d9c7a49d2f9d9cd6ae10ebcdc854d

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f83280d029b1cccc87a9fe24af26a507c4c72ddb62fbe952b84888ce0ae67b7
MD5 455fef40ecc70334d838d948700ac07f
BLAKE2b-256 31b9efe2acb5bebcef0545c52e36167676105654f89c382f865d6c7334c9f9fa

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 86f4ece63d67ec96cf0c61cb1c64610acfaca56dc43abdbf083fc238fd7d00d8
MD5 b4a31afe195f6f5f2a7aa4b5457eff61
BLAKE2b-256 7cd959828b510998fb5c5ee07f434d62000da8c7caa8c32d753606bc8f0f9584

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 592438eb30ab18abcfda49acf9e69cda7ca914ebc2472b276e6827ca42a4d1c3
MD5 d4bb609d5e1cff5c210d0a336b9850f8
BLAKE2b-256 187719f021cfee5bdba40e7acfac0b57c0c2b9953a166ce36fbf5b90e9e5eb4e

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 87916de6f213a45fb90c596594c163f11a5e255b9aec79c9a69a0f311b2540ef
MD5 637454b301398eb66161ddd7f93cec36
BLAKE2b-256 33303ecf6ab63a2deac905981a4eabb9cdcafbda933e929d2e10398d6f4c915f

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6934063d36020e55aa31482acf58116bf089b66130cf79580b6c987d49a47fe6
MD5 b723fdb0b631cf739824c0e00cca7b72
BLAKE2b-256 4f92148c754202be8bd926e75b6675473e4a196fd9cf15ba3fc84d1e63fa4223

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bc3c095792661eeb1fea596941668f4875d0e52d029df7e7546e7fa7dcee7faa
MD5 3b8650ec7bdeb8c1e3fc58770fd0eb7b
BLAKE2b-256 3679698b9fec05d01b5602e65aaf873a34846f2d8cef21778b2def01b3b7529f

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp310-cp310-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp310-cp310-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8641a6e8e52b163ecca912d7351d682d4817ec1b7966fe84e024e171142cea89
MD5 9dbc4313b1d70faeba56355b985e604e
BLAKE2b-256 e9e09fcc4bc01c08c2ca33f403b6bb700db270fdafa19c8de8f0b7ccb433fd97

See more details on using hashes here.

File details

Details for the file obliquetree-1.0.5-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for obliquetree-1.0.5-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 311b8206d08cb5e67367ee9519f8e6fd3d6c2a1867cd8fb0f9ddb6d97327c7bf
MD5 46856ce970d98032319e0402d01b4f41
BLAKE2b-256 b0d08ee4c77bdd7f0edee12f9a0132b309b693dc2885bb4dc617482b331c0c1a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page