Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/rushter/MLAlgorithms
/ f_entropy
Function
f_entropy
mla/ensemble/base.py:6–13 ·
view source on GitHub ↗
(p)
Source
from the content-addressed store, hash-verified
4
5
6
def
f_entropy(p):
7
# Convert values to probability
8
p = np.bincount(p) / float(p.shape[0])
9
10
ep = stats.entropy(p)
11
if
ep == -float(
"inf"
):
12
return
0.0
13
return
ep
14
15
16
def
information_gain(y, splits):
Callers
1
information_gain
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected