Skip to content

Commit

Permalink
Fixed H
Browse files Browse the repository at this point in the history
  • Loading branch information
dombrovski committed Nov 14, 2018
1 parent 62b03a5 commit 2a1a732
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pie_inspect.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ df$n_unsampled <- apply(df[,c('samplehx1','samplehx2','samplehx3', 'samplehx4',
'samplehx5','samplehx6','samplehx7','samplehx8')], 1, function(x)
{sum(na.omit(x)==0)})
# value entropy
# need to NORMALIZE THE VALUE VECTOR, idiot!
df$H <- apply(df[,c('dBetaMu1','dBetaMu2','dBetaMu3','dBetaMu4',
'dBetaMu5','dBetaMu6','dBetaMu7', 'dBetaMu8')], 1, function(x)
{-sum(na.omit(x)*log(na.omit(x)))})
{-sum(na.omit(x/norm(na.omit(as.matrix(x))))*log(na.omit(x/norm(na.omit(as.matrix(x))))))})


# need to mean-center entropy by # segments
Expand Down

0 comments on commit 2a1a732

Please sign in to comment.