Skip to content

Commit

Permalink
BF: AttributeMap -- consider only int (+unsigned) and float to be num…
Browse files Browse the repository at this point in the history
…eric labels

This generalizes the logic and thus unicode labels would also be mapped,
as well as any other odd type.  Use unicode labels for normal_feature_dataset
  • Loading branch information
yarikoptic committed Mar 22, 2019
1 parent aa18b0e commit 2035d75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mvpa2/misc/attrmap.py
Expand Up @@ -150,7 +150,7 @@ def to_numeric(self, attr):
attr = np.asanyarray(attr)

# no mapping if already numeric
if not np.issubdtype(attr.dtype, str) and not self.mapnumeric:
if attr.dtype.kind in 'iuf' and not self.mapnumeric:
return attr

if self._nmap is None:
Expand Down
2 changes: 1 addition & 1 deletion mvpa2/misc/data_generators.py
Expand Up @@ -124,7 +124,7 @@ def normal_feature_dataset(perlabel=50, nlabels=2, nfeatures=4, nchunks=5,
# bring it 'under 1', since otherwise some classifiers have difficulties
# during optimization
data = 1.0 / (np.max(np.abs(data))) * data
labels = np.concatenate([np.repeat('L%d' % i, perlabel)
labels = np.concatenate([np.repeat(u'L%d' % i, perlabel)
for i in range(nlabels)])
chunks = np.concatenate([np.repeat(range(nchunks),
perlabel // nchunks)
Expand Down

0 comments on commit 2035d75

Please sign in to comment.