Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 32a0f98

Browse files
committed
Shuffling has been removed
1 parent 8894065 commit 32a0f98

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

learning.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,33 +1050,25 @@ def grade_learner(predict, tests):
10501050

10511051

10521052
def train_test_split(dataset, start = None, end = None, test_split = None):
1053-
"""If you are giving 'start' and 'end' as a parameter,
1054-
then it will return testing set from index 'start' to 'end'
1055-
and rest for training.
1056-
If you give 'test_split' as parameter then it will first shuffle the
1057-
dataset then return test_split * 100% as testing set and rest as
1053+
"""If you are giving 'start' and 'end' as parameters,
1054+
then it will return the testing set from index 'start' to 'end'
1055+
and the rest for training.
1056+
If you give 'test_split' as a parameter then it will return
1057+
test_split * 100% as the testing set and the rest as
10581058
training set.
10591059
"""
1060-
1061-
if start == None and end != None:
1062-
raise ValueError("'start' parameter is missing")
1063-
1064-
if start != None and end == None:
1065-
raise ValueError("'end' parameter is missing")
1066-
1060+
examples = dataset.examples
10671061
if test_split == None:
1068-
examples = dataset.examples
10691062
train = examples[:start] + examples[end:]
10701063
val = examples[start:end]
1071-
return train, val
10721064
else:
1073-
examples = dataset.examples
10741065
total_size = len(examples)
10751066
val_size = int(total_size * test_split)
10761067
train_size = total_size - val_size
10771068
train = examples[:train_size]
10781069
val = examples[train_size:total_size]
1079-
return train, val
1070+
1071+
return train, val
10801072

10811073

10821074
def cross_validation(learner, size, dataset, k=10, trials=1):

0 commit comments

Comments
 (0)