Skip to content

Commit

Permalink
Merge pull request deepchem#1104 from abster12/master
Browse files Browse the repository at this point in the history
Splitter Tutorial
  • Loading branch information
lilleswing authored Feb 21, 2018
2 parents 8174ab6 + 9fcb688 commit 560ea1b
Show file tree
Hide file tree
Showing 3 changed files with 554 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deepchem/splits/splitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def split(self,
self.valid_indices = []
if self.test_indices is None:
self.test_indices = []
valid_test = self.valid_indices
valid_test = list(self.valid_indices)
valid_test.extend(self.test_indices)
for indice in indices:
if not indice in valid_test:
Expand Down
12 changes: 12 additions & 0 deletions deepchem/splits/tests/test_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,18 @@ def test_stratified_multitask_split(self):
# that have no hits.
assert len(np.where(~w.any(axis=1))[0]) == 0

def test_indice_split(self):

solubility_dataset = dc.data.tests.load_solubility_data()
random_splitter = dc.splits.IndiceSplitter(
valid_indices=[7], test_indices=[8])
train_data, valid_data, test_data = \
random_splitter.split(
solubility_dataset)
assert len(train_data) == 8
assert len(valid_data) == 1
assert len(test_data) == 1


if __name__ == "__main__":
import nose
Expand Down
Loading

0 comments on commit 560ea1b

Please sign in to comment.