Skip to main content

Oblique decision tree using the LAHC heuristic.

Project description

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
pip3 install slsdt
  1. read_csv
from slsdt.reader_csv import read_csv

X, y = read_csv("some_file.csv", "class_column_name")
  1. slsdt
from slsdt.slsdt import SLSDT

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

result = clf.predict(X)

print(result)
print(result == y)

Iris example oblique split

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

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 file for 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 Distribution

slsdt-0.0.2.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

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

slsdt-0.0.2-py2.py3-none-any.whl (12.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file slsdt-0.0.2.tar.gz.

File metadata

  • Download URL: slsdt-0.0.2.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for slsdt-0.0.2.tar.gz
Algorithm Hash digest
SHA256 f5be0faca86d287c111ea7e9ec72b92dae2939ef175367e2a4209cf092b39d92
MD5 5ffe0ff1a36e16310299c5e646241be6
BLAKE2b-256 2b2f5497a7a63cb2afdd6763be0ec0f6c32f873e6c96bff82428a66d04c8379f

See more details on using hashes here.

File details

Details for the file slsdt-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: slsdt-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.8.0 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for slsdt-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b996984e05590e6010a907ec9df6ef50ccec65bba145c52ccae2939e6bcaab98
MD5 7367abd1cb875a44c1802cd294593888
BLAKE2b-256 c81599eb99de1da8e181f7f79368bb6ab9c118f7f7d5370bfa00c28ba6662b2c

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