Coder Social home page Coder Social logo

ziruiyan / sklearn-oblique-tree Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tigert1998/sklearn-oblique-tree

0.0 0.0 0.0 161 KB

a python interface to OC1 and other oblique decision tree implementations

License: GNU General Public License v3.0

Python 2.38% C 95.46% Makefile 0.29% Cython 1.87%

sklearn-oblique-tree's Introduction

๐ŸŒณ Oblique Decision Trees in Python

A python interface to oblique decision tree implementations:

Installation (Python 3)

First install numpy with:

pip install numpy

then run:

pip install git+https://github.com/AndriyMulyar/sklearn-oblique-tree

Use

Trees can be induced with the normal scikit-learn classifier api. For instance:

from sklearn.datasets import load_iris, load_breast_cancer
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn_oblique_tree.oblique import ObliqueTree

random_state = 2

#see Murthy, et all for details.
#For oblique with consideration of axis parallel
#tree = ObliqueTree(splitter="oc1, axis_parallel", number_of_restarts=20, max_perturbations=5, random_state=random_state)
#
#For multivariate CART select 'cart' splitter
#tree = ObliqueTree(splitter="cart", number_of_restarts=20, max_perturbations=5, random_state=random_state)

#consider only oblique splits
tree = ObliqueTree(splitter="oc1", number_of_restarts=20, max_perturbations=5, random_state=random_state)

X_train, X_test, y_train, y_test = train_test_split(*load_iris(return_X_y=True), test_size=.4, random_state=random_state)

tree.fit(X_train, y_train)

predictions = tree.predict(X_test)


print("Iris Accuracy:",accuracy_score(y_test, predictions))

Acknowledgements

VCU Imbalanced Learning and Data Stream Mining Laboratory alt text

Original (unmodified) OC1 Source Code

https://github.com/AndriyMulyar/sklearn-oblique-tree/tree/412d502c04d66046388e469a329d8bcf195bf34b/oc1_implementation

sklearn-oblique-tree's People

Contributors

andriymulyar avatar tigert1998 avatar ziruiyan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.