Git Product home page Git Product logo

treelearn's Introduction

TreeLearn started as a Python implementation of Breiman's Random Forest but is being slowly generalized into a tree ensemble library.

Creating a Random Forest

A random forest is simply a bagging ensemble of randomized tree. To construct these with default parameters:

forest = treelearn.ClassifierEnsemble(base_model = treelearn.RandomizedTree())

Training

Place your training data in a n-by-d numpy array, where n is the number of training examples and d is the dimensionality of your data. Place labels in an n-length numpy array. Then call:

forest.fit(Xtrain,Y)

If you're lazy, there's a helper for simultaneously creating and training a random forest:

forest = treelearn.train_random_forest(X, Y)

Classification

forest.predict(Xtest)

ClassifierEnsemble options

  • base_model = any classifier which obeys the fit/predict protocol

  • num_models = size of the forest

  • bagging_percent = what percentage of your data each classifier is trained on

  • bagging_replacement = sample with or without replacement

  • stacking_model = treat outputs of base classifiers as inputs to given model

RandomizedTree options

  • num_features_per_node = number of features each node of a tree should consider (default = log2 of total features)

  • min_leaf_size = stop splitting if we get down to this number of data points

  • max_height = stop splitting if we exceed this number of tree levels

  • max_thresholds = how many feature value thesholds to consider (use None for all values)

ObliqueTree options

  • num_features_per_node = size of random feature subset at each node, default = sqrt(total number of features)

  • C = Tradeoff between error and L2 regularizer of linear SVM

  • max_depth = When you get to this depth, train an SVM on all features and stop splitting the data.

  • min_leaf_size = stop splitting when any subset of the data gets smaller than this.

treelearn's People

Contributors

iskandr avatar paulhobbs avatar tkaria avatar

Watchers

 avatar  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.