Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on a method to sample part of the data set #18

Open
wants to merge 1 commit into
base: frameworks
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Pilot2/P2B1/p2b1.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ def datagen(self, epoch=0, print_out=1, test=0):
if print_out:
print (files[f_ind], '\n')

print (files[f_ind], '\n')
(X, nbrs, resnums) = helper.get_data_arrays(files[f_ind])

# normalizing the location coordinates and bond lengths and scale type encoding
Expand All @@ -269,8 +270,13 @@ def datagen(self, epoch=0, print_out=1, test=0):

xt_all = np.array([])
yt_all = np.array([])
frames_all = np.array([])

for i in range(num_frames):
num_active_frames = random.sample(range(num_frames),
int(self.sampling_density*num_frames))
print ('Formating on the following frames', self.num_active_frames)
print ('Datagen on the following frames', num_active_frames)
for i in num_active_frames:

if self.conv_net:
xt = Xnorm[i]
Expand Down Expand Up @@ -325,7 +331,10 @@ def train_ac(self):
encoder_weight_file = '%s/%s.hdf5' % (current_path, 'encoder_weights')

for curr_file, xt_all, yt_all in self.datagen(i):
for frame in random.sample(range(len(xt_all)), int(self.sampling_density*len(xt_all))):
print ('Training on the following frames', xt_all)
for frame in self.num_active_frames:
# for frame in random.sample(range(len(xt_all)), int(self.sampling_density*len(xt_all))):
# for frame in range(xt_all):

history = self.molecular_model.fit(xt_all[frame], yt_all[frame], epochs=1,
batch_size=self.batch_size, callbacks=self.callbacks[:2],
Expand Down