Skip to content

Commit

Permalink
Changes for OrSampler
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyKozhevin committed Oct 27, 2023
1 parent cfd17a9 commit 4e003a0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions batchflow/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,13 @@ def sample(self, size):

up_sample = self.bases[0].sample(size=up_size)
low_sample = self.bases[1].sample(size=low_size)
sample_points = np.concatenate([up_sample, low_sample])
sample_points = sample_points[np.random.permutation(size)]
if len(up_sample) > 0 and len(low_sample) > 0:
sample_points = np.concatenate([up_sample, low_sample])
sample_points = sample_points[np.random.permutation(size)]
elif len(up_sample) == 0:
sample_points = low_sample
else:
sample_points = up_sample

return sample_points

Expand Down

0 comments on commit 4e003a0

Please sign in to comment.