本文整理汇总了Python中sklearn.covariance.EmpiricalCovariance.score方法的典型用法代码示例。如果您正苦于以下问题:Python EmpiricalCovariance.score方法的具体用法?Python EmpiricalCovariance.score怎么用?Python EmpiricalCovariance.score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.covariance.EmpiricalCovariance
的用法示例。
在下文中一共展示了EmpiricalCovariance.score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: xrange
# 需要导入模块: from sklearn.covariance import EmpiricalCovariance [as 别名]
# 或者: from sklearn.covariance.EmpiricalCovariance import score [as 别名]
# Fold the angles in params into proper range, such that
# they centered at the mean.
N_CYCLE_FOLD_ANGLE = 10
for j in xrange(N_CYCLE_FOLD_ANGLE):
mean = np.mean(params, axis=0)
for i in xrange(3, 6): # index 3,4,5 are angles, others are distances
params[:, i][params[:, i] > mean[i] + np.pi] -= 2 * np.pi
params[:, i][params[:, i] < mean[i] - np.pi] += 2 * np.pi
if PARAMS_TLR[i] > mean[i] + np.pi:
PARAMS_TLR[i] += 2 * np.pi
if PARAMS_TLR[i] < mean[i] - np.pi:
PARAMS_TLR[i] -= 2 * np.pi
est = EmpiricalCovariance(True, False)
est.fit(params)
log_likelyhood = est.score(PARAMS_TLR[None, :])
KT = 0.59
free_e = -log_likelyhood * KT
print 'Log likelyhood score:', log_likelyhood
print 'Free energy:', free_e
###### Output the best conformer to pdb ######
def generate_bp_par_file(params, bps, out_name):
assert(len(params) == len(bps))
n_bp = len(params)
# convert from radians to degrees
params[:, 3:] = np.degrees(params[:, 3:])
out_str = "%4d # base-pairs\n" % n_bp