fix bug: while the task of csv dataset is classification #1533
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix bug: while the task of csv dataset is classification, y is still float, so there is exception arise:
Traceback (most recent call last):
File "/home/junbo.chenjb/Backup/eclipse-kepler/plugins/org.python.pydev_2.8.1.2013072611/pysrc/pydevd.py", line 1445, in
debugger.run(setup['file'], None, None)
File "/home/junbo.chenjb/Backup/eclipse-kepler/plugins/org.python.pydev_2.8.1.2013072611/pysrc/pydevd.py", line 1091, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/home/junbo.chenjb/workspace/pylearn2_ext/tools/simple_train.py", line 15, in
train.main_loop()
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/train.py", line 201, in main_loop
extension_continue = self.run_callbacks_and_monitoring()
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/train.py", line 255, in run_callbacks_and_monitoring
self.model.monitor()
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/monitor.py", line 254, in call
for X in myiterator:
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/utils/iteration.py", line 984, in next
rval = self._fallback_next(next_index)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/utils/iteration.py", line 1002, in _fallback_next
for data, fn in safe_izip(self._raw_data, self._convert)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/utils/iteration.py", line 1002, in
for data, fn in safe_izip(self._raw_data, self._convert)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/utils/iteration.py", line 952, in
dspace.np_format_as(batch, sp))
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/space/init.py", line 486, in np_format_as
space=space)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/space/init.py", line 541, in _format_as
self._validate(is_numeric, batch)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/space/init.py", line 726, in _validate
self._validate_impl(is_numeric, batch)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/space/init.py", line 1096, in _validate_impl
super(IndexSpace, self)._validate_impl(is_numeric, batch)
File "/home/junbo.chenjb/libs/pylearn2/pylearn2/space/init.py", line 905, in _validate_impl
(batch.dtype, self.dtype))
TypeError: Cannot safely cast batch dtype float64 to space's dtype int64.