Metadata-Version: 2.1
Name: slsdt
Version: 0.0.2
Summary: Oblique decision tree using the LAHC heuristic. 
Home-page: https://github.com/jhonatangs/slsdt
Author: Souza, J.G. and Santos, H.G.
Author-email: jhonatan.souza@aluno.ufop.edu.br
License: EPL-2.0
Keywords: Oblique Decision Tree,Machine Learning,Classification,Heuristic,Optimization
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >3.5.0
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: numba
Requires-Dist: scikit-learn


# SLSDT

Stochastic Local Search Decision Tree

This repository is for my first scientific initiation project.

## About

Oblique Decision Tree is a algorithm for induction a machine learning method called decision tree using oblique approach.

SLSDT is a method for induction oblique decision trees using stochastic local search method called Late Acceptance Hill-Climbing (LAHC).

This project also provides a utility to read csv files and convert to the format accepted by the SLSDT method.

## How to use

1. Install

```bash
pip3 install slsdt
```

2. read_csv

```python
from slsdt.reader_csv import read_csv

X, y = read_csv("some_file.csv", "class_column_name")
```

3. slsdt

```python
from slsdt.slsdt import SLSDT

clf = SLSDT()
clf.fit(X, y)

result = clf.predict(X)

print(result)
print(result == y)
```

## Iris example oblique split

```python
from sklearn import datasets
from slsdt.slsdt import SLSDT

iris = datasets.load_iris()
X = iris.data[:, :2] # we only take the sepal width and sepal length features.
y = iris.target

mark = y != 2

# we only take the 0 (Iris-setosa) and 1 (Iris-versicolor) class labels
X = X[mark]
y = y[mark]

clf = SLSDT()
clf.fit(X, y)
clf.print_tree()

result = clf.predict(X)

print(result)
print(result == y)
```

### Plot iris oblique split

![alt text](https://github.com/jhonatangs/slsdt/blob/main/oblique-split-iris.png "Iris oblique split")

Plot with Matplotlib using the results obtained above.

## How to contribute

-   Leave the :star: if you liked the project
-   Fork this project
-   Cloner your fork: `git clone your-fork-url && cd slsdt`
-   Create a branch with your features: `git checkout -b my-features`
-   Commit your changes: `git commit -m 'feat: My new features'`
-   Send the your branch: `git push origin my-features`

## License

This project is licensed under the EPL 2.0 License - see the [LICENSE](https://github.com/jhonatangs/slsdt/blob/main/LICENSE) file for details.


