Skip to main content

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 a custom L-BFGS optimization routine 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
    top_k=None,             # Optional: keep the default oblique feature screening heuristic
    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.

  • Parallel Split Search Utilizes OpenMP-based parallelism during tree construction to evaluate splits in parallel across features, enabling significant speedups on multi-core systems.

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

    • Up to 600% faster for datasets with float columns.
    • Up to 400% 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.

Metadata

Release files for obliquetree 1.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for obliquetree 1.1.1
File
obliquetree-1.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
obliquetree-1.1.1-cp313-cp313-musllinux_1_2_x86_64.whl CPython 3.13 CPython 3.13 Linux musl 1.2+ x86-64 Details
obliquetree-1.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
obliquetree-1.1.1-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details
obliquetree-1.1.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
obliquetree-1.1.1-cp312-cp312-musllinux_1_2_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.2+ x86-64 Details
obliquetree-1.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
obliquetree-1.1.1-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details
obliquetree-1.1.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
obliquetree-1.1.1-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details
obliquetree-1.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
obliquetree-1.1.1-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details
obliquetree-1.1.1-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
obliquetree-1.1.1-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details
obliquetree-1.1.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
obliquetree-1.1.1-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details

Total release size: 53.7 MB

Release files / obliquetree-1.1.1-cp313-cp313-win_amd64.whl

Download URL obliquetree-1.1.1-cp313-cp313-win_amd64.whl
Size 1.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
2c21ef0f7d89ac2421d56dcd354d1c269fcf8626abb88306629117b23b904dfb
BLAKE2b-256 checksum
How to use checksums
fd0a6986bf63b7fa2d4b2e7e24fe353c172bf52fb3a2e102f4f315847eb035ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp313-cp313-musllinux_1_2_x86_64.whl

Download URL obliquetree-1.1.1-cp313-cp313-musllinux_1_2_x86_64.whl
Size 5.7 MB
Tags CPython 3.13 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
02abbca08a09f86ad4e8fb67b3144084595249c674f3c92e8390e988d33c9982
BLAKE2b-256 checksum
How to use checksums
f0327ed65e9607e75aadb18d1c0ed3103c0521aa783ed13396d706cb5c704dc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL obliquetree-1.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 4.6 MB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b3615305c21819e97817d170d59b8d5790950d977864373b726c828b8567dc15
BLAKE2b-256 checksum
How to use checksums
4d281f676ca8fddef6a1c1577d1700015158a8bc8491f790a9a08402fdb91124
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp313-cp313-macosx_15_0_arm64.whl

Download URL obliquetree-1.1.1-cp313-cp313-macosx_15_0_arm64.whl
Size 1.7 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
ca67d2d4b21d0f399dd3f89248b0fef7b4cdd88622cf3bb0a54072877d6b2597
BLAKE2b-256 checksum
How to use checksums
5542fa17f680b930ee5a49249ed85dbc513a6189b6be749126d3e3b9bc31ed4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp312-cp312-win_amd64.whl

Download URL obliquetree-1.1.1-cp312-cp312-win_amd64.whl
Size 1.4 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2fa33fdf8739352239264c5eace7b2f1307cd08d8276a335b8f5acda9cbde2f7
BLAKE2b-256 checksum
How to use checksums
7a06124d263535b124159e1c68f3f8c0b4795a04089bf449cffd3b1eec45c3c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp312-cp312-musllinux_1_2_x86_64.whl

Download URL obliquetree-1.1.1-cp312-cp312-musllinux_1_2_x86_64.whl
Size 5.7 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
2964fc4c44b61dbde9232ccbf131aaa90ddeb0e3b03f54bca65de118bb2f35dd
BLAKE2b-256 checksum
How to use checksums
d6951f54a3054d700c199165eeb3cc4cb74ebeecf09944e60e84aa9440aa349e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL obliquetree-1.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 4.6 MB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
6d61cd3c7943b93b11e5b77cac2804c6992d6941db73ecbc521817b4a51d37a4
BLAKE2b-256 checksum
How to use checksums
3cb35074eb795165188868ea476410bd147cc79ad82dd014004c35de1937c30f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp312-cp312-macosx_15_0_arm64.whl

Download URL obliquetree-1.1.1-cp312-cp312-macosx_15_0_arm64.whl
Size 1.7 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
bb98f4faf5adf1af17dfc3347993800ac02dd4b4a8b57c593341c19d5b8be8e5
BLAKE2b-256 checksum
How to use checksums
0950e3013b89a8e905333077aece6cf430ab5f28c27d389e48314129999271a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp311-cp311-win_amd64.whl

Download URL obliquetree-1.1.1-cp311-cp311-win_amd64.whl
Size 1.4 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
0e6db113891959065d96b7ac52b69872555d7581abd7aee33d8e6dc0da4c0380
BLAKE2b-256 checksum
How to use checksums
41b4da5f43efddc62c70b203243aae81088bf58328ee1e13e4673b5b3bf07d98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL obliquetree-1.1.1-cp311-cp311-musllinux_1_2_x86_64.whl
Size 5.7 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
ccf2f949800097ecca0538d5f995f548707ff286b2e8b2932d6f3dc18265e0ab
BLAKE2b-256 checksum
How to use checksums
d338822315933aee8a17d45234fc5d03308f526fe15c2917a36f6b95b5915d20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL obliquetree-1.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 4.7 MB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
02ef7486327a61e075a8ea7536fc8c5a2aff447370bb2581f1a380f37aa0bab9
BLAKE2b-256 checksum
How to use checksums
a63ac01b0dfa2798349ff20a547907e8d82304b8c718082c60d1d66cbb01b79b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp311-cp311-macosx_15_0_arm64.whl

Download URL obliquetree-1.1.1-cp311-cp311-macosx_15_0_arm64.whl
Size 1.7 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
1c9ea72331b658f39f15a2cccebdef1317892fcab12f7ca3e16cc7151036d5a2
BLAKE2b-256 checksum
How to use checksums
c16149419bfbf379eefb34e134fcad358cb1805a85ce4fbf3ade5b5de3977b87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp310-cp310-win_amd64.whl

Download URL obliquetree-1.1.1-cp310-cp310-win_amd64.whl
Size 1.4 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
3b9849bd9af5f6ddc165e495cc351d99f742a6d85a3e387f29363c00b16b73e8
BLAKE2b-256 checksum
How to use checksums
63837769516a6d0b8edd92cb985c16f0f9b535378f3d1dece4a5500817152e08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL obliquetree-1.1.1-cp310-cp310-musllinux_1_2_x86_64.whl
Size 5.6 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
d4653bfdc5196dc5cc5022fa6cd44e85a66fd6712b245282fea38d8a920160e5
BLAKE2b-256 checksum
How to use checksums
d15d3563e9d4a5552e64fe9b4914cefddb7892b48e35cf2aafc626dce5f03022
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL obliquetree-1.1.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 4.5 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1e3d9ab847f48b586ad3d6f6e77113408674fc571eb65f2ecf4c109d90157311
BLAKE2b-256 checksum
How to use checksums
5d206765a4ff1d7455b234f022b8f661c1294cf2de8953fbad1e0dc80d3a371e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / obliquetree-1.1.1-cp310-cp310-macosx_15_0_arm64.whl

Download URL obliquetree-1.1.1-cp310-cp310-macosx_15_0_arm64.whl
Size 1.7 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
66326ff3e82b2d4e4c8ee969156769da61b2dca4cbcc6f4949cca0dd911e8986
BLAKE2b-256 checksum
How to use checksums
6a15bb459c7494cb58eadaf5286629dbeb8f5543ea9dd66c372143e46b529002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.1.1 This release

16 release files

1.1.0

16 release files

1.0.7

16 release files

1.0.6

16 release files

1.0.3

16 release files

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