Project: neural_reaction_fingerprint Author: jnwei File: util.py (license) View Source Project

def collect_test_losses(num_folds):
    # Run this after CV results are in. e.g:
    # python -c "from deepmolecule.util import collect_test_losses; collect_test_losses(10)"
    results = {}
    for net_type in ['conv', 'morgan']:
        results[net_type] = []
        for expt_ix in range(num_folds):
            fname = "Final_test_loss_{0}_{1}.pkl.save".format(expt_ix, net_type)
            try:
                with open(fname) as f:
                    results[net_type].append(pickle.load(f))
            except IOError:
                print "Couldn't find file {0}".format(fname)

    print "Results are:"
    print results
    print "Means:"
    print {k : np.mean(v) for k, v in results.iteritems()}
    print "Std errors:"
    print {k : np.std(v) / np.sqrt(len(v) - 1) for k, v in results.iteritems()}
  • python

    Python (发音:[ paiθ(ə)n; (US) paiθɔn ]n. 蟒蛇,巨蛇 ),是一种面向对象的解释性的计算机程序设计语言,也是一种功能强大而完善的通用型语言,已经具有十多年的发…

    7952 引用 • 22 回帖 • 2 关注
  • numpy

    NumPy 是一个基础科学的计算包,包含: 一个强大的 N 维数组对象 sophisticated (broadcasting) functions tools for integrating C/C++ and Fortran code 有用的线性代数…

    1115 引用 • 1 关注
感谢    赞同    分享    收藏    关注    反对    举报    ...