Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug: while the task of csv dataset is classification #1533

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

junbochen
Copy link
Contributor

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.

@lamblin
Copy link
Member

lamblin commented Jun 17, 2015

Thanks! Sorry for the late reply.
Do you think you could add a small unit test so we can detect if it gets broken again?

@junbochen
Copy link
Contributor Author

@lamblin : the unittest is updated, to check the data type of the target variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants