lowe_interactive_predict.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ochem_predict_nn 作者: connorcoley 项目源码 文件源码
def score_candidates(reactants, candidate_list, xs):

    pred = model.predict(xs, batch_size = 20)[0]
    rank = ss.rankdata(pred)

    fname = raw_input('Enter file name to save to: ') + '.dat'
    with open(os.path.join(FROOT, fname), 'w') as fid:
        fid.write('FOR REACTANTS {}\n'.format(Chem.MolToSmiles(reactants)))
        fid.write('Candidate product\tCandidate edit\tProbability\tRank\n')
        for (c, candidate) in enumerate(candidate_list):
            candidate_smile = candidate[0]
            candidate_edit = candidate[1]
            fid.write('{}\t{}\t{}\t{}\n'.format(
                candidate_smile, candidate_edit, pred[c], 1 + len(pred) - rank[c]
            ))
    print('Wrote to file {}'.format(os.path.join(FROOT, fname)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号