Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion utils/datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def name(self):
@property
def n_categories(self):
if self._n_categories is None:
assert self.training_set.target.dtype in (int, str), \
target_dtype = self.training_set.target.dtype
assert (np.issubdtype(target_dtype, int) or np.issubdtype(target_dtype, str)), \
'n_categories is only a valid attribute when target data is int or str. It is %s' \
% (self.training_set.target.dtype, )
self._n_categories = len(np.unique(self.training_set.target))
Expand Down