Git Product home page Git Product logo

hdtree's Introduction

HDTree - Python implementation of a Decision Tree

Installation

A directory containing this repository has to be put into your Python search path. Alternatively you can directly add the directory to your site-packages folder of your python interpreter.

Documentation

Related repositories

This package can be used standalone, but is part of a bigger framework called LoE (League of Experts). The main repository can be found here

hdtree's People

Contributors

mereep avatar webdes87 avatar tschlosser13 avatar

Stargazers

Dongsheng Fang avatar peter.linyi avatar  avatar Ipakeev avatar Artem Bashev avatar  avatar

Watchers

James Cloos avatar  avatar

hdtree's Issues

Information Measure Change does not influence the model

class AccuracyMeasure(AbstractInformationMeasure):
    def supports_regression(self):
        return False

    def supports_classification(self):
        return True

    def calculate_for_children(self, parent_node):
        child_nodes = parent_node.get_children()
        if child_nodes is None:
            child_nodes = []

        node = None
        # calculate accuracy for each node

        n_total_samples = sum(len(node.get_labels()) for node in child_nodes)
        pureness_childs = 0.
        for node in child_nodes:
            child_cats = node.get_labels()
            accuracy = self.calculate_for_single_node(node=node)
            pureness_childs += accuracy*1/len(child_nodes)# * len(child_cats)/n_total_samples
        return np.random.uniform()

    def calculate_for_labels(self, labels, normalize=True):
        node_cats = labels
        most_common_class = Counter(node_cats).most_common()[0][0]
        accuracy = sum(node_cats == most_common_class) / len(node_cats)
        print("ciao")
        return np.random.uniform()

hdtree_linear_acc = HDTreeClassifier(max_levels=15, allowed_splits=[SmallerThanSplit.build()],
                                 information_measure=AccuracyMeasure())

hdtree_linear_entropy = HDTreeClassifier(max_levels=15, allowed_splits=[SmallerThanSplit.build()],
                                 information_measure=EntropyMeasure())

Hi I am trying to define a new measure but I have noticed that using random scores we obtain the same results of EntropyMeasure

EntropyMeasure
acc 0.8354972039873572
prec 0.4819277108433735
recall 0.05938242280285035
f1 0.10573618821041501

AccuracyMeasure
acc 0.8354972039873572
prec 0.4819277108433735
recall 0.05938242280285035
f1 0.10573618821041501

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.