コード例 #1
0
ファイル: train.py プロジェクト: jcheminform/graphvae_approx
save_dict = './'

print(':: load data')
with open(data_path, 'rb') as f:
    [DV, DE, DY, Dsmi] = pkl.load(f)

DV = DV.todense()
DE = DE.todense()
DY = DY

n_node = DV.shape[1]
dim_node = DV.shape[2]
dim_edge = DE.shape[3]
dim_y = DY.shape[1]

print(':: preprocess data')
scaler = StandardScaler()
scaler.fit(DY)
DY = scaler.transform(DY)

mu_prior = np.mean(DY, 0)
cov_prior = np.cov(DY.T)

model = Model(n_node, dim_node, dim_edge, dim_y, mu_prior, cov_prior)

print(':: train model')
with model.sess:
    load_path = None
    save_path = save_dict + data + '_model.ckpt'
    model.train(DV, DE, DY, Dsmi, atom_list, load_path, save_path)
コード例 #2
0
ファイル: train.py プロジェクト: seokhokang/graphvae_compress
save_path = './guacamol_model.ckpt'

print(':: load data')
with open(data_path, 'rb') as f:
    [DV, DE, DY, Dsmi] = pkl.load(f)

n_node = DV.shape[1]
dim_node = DV.shape[2]
dim_edge = DE.shape[3]
dim_y = DY.shape[1]

atom_list = ['B', 'C', 'N', 'O', 'F', 'Si', 'P', 'S', 'Cl', 'Se', 'Br', 'I']
bond_list = ['SINGLE', 'DOUBLE', 'TRIPLE']
bpatt_dim = [3, 3, 2, 1, 2, 1]

print(':: preprocess data')
scaler = StandardScaler()
scaler.fit(DY)
DY = scaler.transform(DY)

mu_prior = np.mean(DY, 0)
cov_prior = np.cov(DY.T)

model = Model(n_node, dim_node, dim_edge, dim_y, atom_list, bpatt_dim,
              mu_prior, cov_prior)

print(':: train model')
with model.sess:
    load_path = None
    model.train(DV, DE, DY, Dsmi, load_path, save_path)