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)))
lowe_interactive_predict.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录