Skip to content

Commit

Permalink
fix data generator for kernel integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Apr 2, 2013
1 parent cf38f2c commit 73f200d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/integration/generator/dataop.py
Expand Up @@ -5,7 +5,7 @@
import string
import numpy
from numpy import random, round
from shogun.Features import Labels
from shogun.Features import BinaryLabels, RegressionLabels

NUM_VEC_TRAIN=11
NUM_VEC_TEST=17
Expand Down Expand Up @@ -155,14 +155,15 @@ def get_labels (num, ltype='twoclass'):
labels=[]
if ltype=='twoclass':
labels.append(random.rand(num).round()*2-1)
# essential to wrap in array(), will segfault sometimes otherwise
labels.append(BinaryLabels(numpy.array(labels[0])))
elif ltype=='series':
labels.append([numpy.double(x) for x in xrange(num)])
# essential to wrap in array(), will segfault sometimes otherwise
labels.append(RegressionLabels(numpy.array(labels[0])))
else:
return [None, None]

# essential to wrap in array(), will segfault sometimes otherwise
labels.append(Labels(numpy.array(labels[0])))

return labels


Expand Down

0 comments on commit 73f200d

Please sign in to comment.