maxpumperla / entropy-mdlp

Minimum description length principle algorithm in Python, for optimal binning of continuous variables
MIT License
59 stars 20 forks source link

example #2

Closed jeweinberg closed 5 years ago

jeweinberg commented 7 years ago

Hi could you please provider an example of how you would use this tool to discretize a variable?

19kka commented 5 years ago

Try it

# -*- coding: utf-8 -*-
import mdlp
obj = mdlp.MDLP()

x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [0, 0, 0, 1, 1, 1, 1, 1, 1, 1]

#The function will return the index of this point
#       and the respective entropy.
print obj.find_cut_index(x, y)

Output: [3, -0.0]