Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    dtree 0.2.1

    Download button

    No screenshots available
    Downloads: 134  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Chris Spencer | More programs
    LGPL / FREE
    February 10th, 2012, 08:53 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    dtree description

    A simple pure-Python batch decision tree construction algorithm

    dtree is a simple pure-Python decision tree construction algorithm.

    Given a training data set, it constructs a decision tree for classification or regression in a single batch.

    It loads data from CSV files. It expects the first row in the CSV to be a header, with each element conforming to the pattern "name:type:mode". Mode is optional, and denotes the class attribute. Type identifies the attribute as either a continuous, discrete, or nominal.

    The module is loosely based on code published by Christopher Roach in his article Building Decision Trees in Python. I refactored his code to be more object-oriented, and extended it to support basic regression.

    The class attribute can be either continuous, discrete or nominal, but all other attributes can only be discrete or nominal.

    Installation

    Download the code and then run:

    python setup.py build
    sudo python setup.py install


    You can also install from PyPI using pip via:

    sudo pip install dtree

    Or upgrade from an earlier version via:

    sudo pip install --upgrade dtree

    Usage

    Classification and regression are handled through the same interface, and differ only in the object returned by the predict() method and how the result from test() is interpreted.

    With classification, this object will always be a DDist instance, representing a probability distribution over a set of discrete or nominal classes. In this case, the result from test() will be a CDist instance representing the classification accuracy.

    With regression, this object will always be a CDist instance, representing a mean and variance. In this case, the result from test() will be a CDist instance representing the mean absolute error.

    from dtree import DTree, FileData

    tree = DTree.build(FileData('classification-training.csv'))
    result = t.test(FileData('classification-testing.csv'))
    print 'Accuracy:',result.mean
    prediction = tree.predict(dict(feature1=123, feature2='abc', feature3='hot'))
    print 'best:',prediction.best
    print 'probs:',prediction.probs

    tree = DTree.build(FileData('regression-training.csv'))
    result = t.test(FileData('regression-testing.csv'))
    print 'MAE:',result.mean
    prediction = tree.predict(dict(feature1=123, feature2='abc', feature3='hot'))
    print 'mean:',prediction.mean
    print 'variance:',prediction.variance



    Product's homepage

    Here are some key features of "dtree":

    · classification and regression

    Requirements:

    · Python

      


    TAGS:

    construction algorithm | decision tree | Python library | construction | algorithm | decision

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM