我有一个数据集,我从中选择var中给出的每个列,然后调用R函数来计算度量。 当产生较低的功率时,通过mc_adj改变功率,并且打印mc_adj和更低的各种值并对应 值存储在单独的列表中。
var = ['Siver','cent','Multiplex']
#Medcouple:
#mc = medcouple_1d(y)
for k,v in enumerate(var):
# use medcouple from mrfDepth (R) for now:
y = np.array(final_data[v])
mc = use_r_medcouple(y)
# Evaluate lower bound based on mc:-
iqr_x = iqr(y)
q1 = np.percentile(y,25)
# Pass the power as a parameter :
mc_adj = range(1,25)
power = []
cutoff = []
params = {}
for i in mc_adj:
# Generate lower for various values of power - to determine optimal cutoff.
if (mc > 0):
lower= q1 - 1.5*np.power(e,-mc_adj[i-1]*mc)*iqr_x
else:
lower = q1 - 1.5*np.power(e,-mc_adj[i-1]*mc)*iqr_x
print (mc_adj[i-1],lower)
#Output
#1 -0.5159729533251924
#2 -0.2867442303545527
#3 -0.13645482753920707
# cutoff should contain only from here
#4 0.0379204715218498
#5 0.02668168361269674
#6 0.06903684395182615
power.append(mc_adj[i-1])
cutoff.append(lower)
我希望将cutoff子集仅包含大于0的值,并创建一个字典,每个var作为键,相应的列表作为值。
'Siver' :'[0.7064935843796287, 1.325222704596175, 1.7503065451918585]'
'cent':'[0.0379204715218498, 0.02668168361269674, 0.06903684395182615]'
以下是示例数据:
Siver Multiplex cent
52.47 76.38 78.72
45.36 07.65 76.68
14.93 0 58.83
9.67 0 51.47
37.98 35.69 17.48
1.88 124.28 43.79
3.77 130.50 59.27
0 9.90 63.05
有人可以帮我解决这个问题吗?