提交 d50d1fa4 作者: 杨锋

Initial commit

上级
The source code of retrosynthesis prediction.
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
import pandas as pd
import numpy as np
from rdchiral import template_extractor
from tqdm import tqdm
import multiprocessing
cores = multiprocessing.cpu_count()
pool = multiprocessing.Pool(cores)
template_train = pd.read_csv('/notebooks/Codes/brs/USPTO/schneider50k/template_train.csv')
template_test = pd.read_csv('/notebooks/Codes/brs/USPTO/schneider50k/template_test.csv')
template_val = pd.read_csv('/notebooks/Codes/brs/USPTO/schneider50k/template_val.csv')
raw_data = pd.concat((template_train,template_test,template_val))
def extract(reaction):
try:
return template_extractor.extract_from_reaction(reaction)
except KeyboardInterrupt:
raise KeyboardInterrupt
except Exception as e:
return 'Err'
reactions = [{'_id': reaction[0], 'reactants': reaction[2].split('>>')[0], 'products': reaction[2].split('>>')[1]} for reaction in raw_data.values]
# templates = pool.map(extract, tqdm(reactions))
templates = [extract(reaction) for reaction in tqdm(reactions)]
print(123)
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
loss,accuracy
0.004026058129966259,61.567686462707464
0.0037154078017920256,60.84783043391322
0.003669698955491185,61.2877424515097
0.004232234321534634,61.187762447510494
0.004387203138321638,60.64787042591482
0.003995717503130436,61.2877424515097
0.00400707870721817,60.887822435512895
0.0044508883729577065,60.96780643871226
0.004024198278784752,61.2877424515097
0.003794693388044834,61.087782443511294
loss,accuracy
0.0035638760309666395,87.64247150569886
0.0031065840739756823,87.84243151369726
0.003881766926497221,87.5624875024995
0.0045944699086248875,87.76244751049789
0.0034541983623057604,87.84243151369726
0.004402834922075272,87.60247950409918
0.004115797113627195,87.80243951209758
0.0042515951208770275,87.54249150169966
0.0036142636090517044,87.74245150969806
0.005122682545334101,87.84243151369726
loss,accuracy
0.004491719417273998,78.94421115776845
0.0037716312799602747,79.2241551689662
0.003074276028200984,78.88422315536893
0.003592598019167781,79.40411917616477
0.0029139474499970675,79.3241351729654
0.004435064736753702,79.2241551689662
0.0036734032910317183,78.6642671465707
0.003433571895584464,78.96420715856829
0.003273188369348645,79.16416716656668
0.0036596572026610374,79.124175164967
loss,accuracy
0.003986424766480923,83.90321935612877
0.004227079451084137,83.80323935212958
0.004254240542650223,84.02319536092782
0.0042970869690179825,83.88322335532894
0.0040547908283770084,84.06318736252749
0.003926473669707775,83.94321135772846
0.003974240738898516,83.74325134973006
0.005630603991448879,83.98320335932813
0.004349200986325741,83.84323135372925
0.0041490886360406876,83.80323935212958
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论