Skip to content

Commit

Permalink
Change dtype check conditional to look for everything other than int
Browse files Browse the repository at this point in the history
  • Loading branch information
hamsal committed Aug 8, 2014
1 parent a5acf9d commit 7cfea35
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sklearn/utils/random.py
Expand Up @@ -232,8 +232,9 @@ def random_choice_csc(n_samples, classes, class_probability=None,

for j in range(len(classes)):
classes[j] = np.asarray(classes[j])
if classes[j].dtype.kind is 'f':
raise ValueError("Class type float is not supported")
if classes[j].dtype.kind != 'i':
raise ValueError("class dtype %s is not supported" %
classes[j].dtype)
classes[j] = classes[j].astype(int)

# use uniform distribution if no class_probability is given
Expand Down

0 comments on commit 7cfea35

Please sign in to comment.