def getEntropy(data, unit='shannon'):<br /> base = {<br /> 'shannon' : 2.,<br /> 'natural' : math.exp(1),<br /> 'hartley' : 10.<br /> }<br /> if len(data) <= 1:<br /> return 0<br /> <br /> counts = Counter()<br /> <br /> for d in data:<br /> counts[d] += 1<br /> <br /> probs = [float(c) / len(data) for c in counts.values()]<br /> probs = [p for p in probs if p > 0.]<br /> <br /> ent = 0<br /> <br /> for p in probs:<br /> if p > 0.:<br /> ent -= p * math.log(p, base[unit])<br /> <br /> return ent<br />
输入就是data,是一个数组,输出就是熵值,调用就直接getEntropy(data)
boxplot(interval~tag,data=data,main="The issue resolution latency of two tag",
ylab="interval",xlab="The issue resolution latency of 0 and 1 ",ylim=c(0,400000))
wilcox.test(interval~tag,data=data)
boxplot(log(interval+0.5)~round(24*60*ave_multi_user_time),data=data,xlim=c(0,100))
result<-lm(scale(log(interval+0.5))~
scale(log(all_user_ids))
+scale(log(multi_user_ids+0.5))
+ave_multi_issues,data=M)
summary(result)
require(car)
vif(result)