Metadata-Version: 2.4
Name: decisive-tree
Version: 0.1.1
Summary: A collection of very decisive decision trees
Author-email: Mateus Diniz <mateushmdiniz@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Mateus Diniz
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/mateushmd/decisive-tree
Project-URL: Bug Tracker, https://github.com/mateushmd/decisive-tree/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy==2.3.3
Requires-Dist: pandas==2.3.2
Requires-Dist: treelib==1.8.0
Requires-Dist: matplotlib==3.10.6
Requires-Dist: seaborn==0.13.2
Dynamic: license-file

# Decisive Tree

[![PyPI Version](https://img.shields.io/pypi/v/decisive-tree.svg)](https://pypi.org/project/decisive-tree/)
[![Python Version](https://img.shields.io/pypi/pyversions/decisive-tree.svg)](https://pypi.org/project/decisive-tree/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Build Status](https://img.shields.io/github/actions/workflow/status/mateushmd/decisive-tree/publish.yml)](https://github.com/mateushmd/decisive-tree/actions)

A from-scratch Python implementation of the ID3, C4.5, and CART decision tree algorithms, created for educational purposes.

This project provides a clear and understandable look into the core mechanics of these foundational machine learning models, from the splitting criteria to the recursive tree-building process. It also includes a suite of from-scratch utilities for data preprocessing and model evaluation.

## Key Features

* **ID3 Algorithm**: Implements the classic algorithm using Information Gain, perfect for datasets with nominal features.
* **C4.5 Algorithm**: An extension of ID3 using Gain Ratio to handle both nominal (multi-way split) and continuous features (binary split).
* **CART Algorithm**: Implements Classification and Regression Trees using Gini Impurity (for classification) and Variance Reduction (for regression) with strictly binary splits for all feature types.
* **Utilities**: Includes custom, understandable implementations of:
    * Data splitting and preprocessing (`split_data`, `one_hot_encode`, `ordinal_encode`).
    * Model evaluation (`get_confusion_matrix`, `calculate_metrics`, `plot_confusion_matrix`).
* **Tree Visualization**: All models include a `.plot()` method for a simple console-based visualization of the resulting tree structure.

---

## Installation

You can install `decisive-tree` directly from PyPI:

```sh
pip install decisive-tree
