Commit ba03b250 authored by Anze Vavpetic's avatar Anze Vavpetic Committed by Anze Vavpetic
Browse files

added support for stratified x-validation, if the input is as an orange table or dbcontext

parent 3549f035
......@@ -231,18 +231,19 @@ class Workflow(models.Model):
current_iteration = 0
# create folds
folds = []
if hasattr(input_list, "get_items_ref"):
import orange
# Orange table on input, so we cannot do slices
indices = range(len(input_list))
folds_indices = [indices[i::input_fold] for i in range(input_fold)]
folds = []
for fold_indices in folds_indices:
indices = orange.MakeRandomIndicesCV(input_list, randseed=input_seed)
for i in range(input_fold):
output_train =, i, negate=1)
output_test =, i)
folds.append((output_train, output_test))
folds = [input_list[i::input_fold] for i in range(input_fold)]
# pass forward the seed
......@@ -258,6 +259,11 @@ class Workflow(models.Model):
for i in range(len(folds)):
#import pdb; pdb.set_trace()
if hasattr(input_list, "get_items_ref"):
output_test = folds[i][0]
output_train = folds[i][1]
output_train = folds[:i] + folds[i+1:]
output_test = folds[i]
if input_type == 'DBContext':
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment