On Tue, Jun 02, 2015, Vincent Alexander Saulys wrote:
> Well I do wrap the data as a Conv2DSpace in the training yaml file. I have
> trouble following the
> flow of the code here as the yaml file gets parsed out, I was curious if
> anybody could point to
> how to do this? I know that
> <
http://deeplearning.net/software/pylearn2/internal/data_specs.html>
> has information on this, but they don't seem to actually have any examples,
> just detailed write
> ups.
Right, that part is mainly about explaining how things are currently
organized and called, not how to implement new functionalities based on
that framework.
> What I have is a CSV, with the first column being a target value (this is a
> regression problem) and the
> following columns being features. I want to transform this into a
> Conv2DSpace of shape [1,20014] &
> number of channels being 1. Whats the way to do this?
The dataset's iterator will take care of the conversion, what you need
is to tell it how you want the data.
For instance, if "dataset" is your instance of CSVDataset containing
the data, and "model" is your model:
data_space = model.get_input_space() # should be a Conv2DSpace
data_source = model.get_input_source() # probably "features"
data_specs = (data_source, data_space)
iter = dataset.iterator(mode='sequential',
batch_size=batch_size,
data_specs=data_specs)
Then you need the prediction function:
X = data_space.make_theano_batch('X')
pred = model.fprop(X)
predict = theano.function([X], pred)
And then you can call that "predict" function on the data coming from
the iterator:
predictions = []
for item in iter:
predictions.append(predict(*item))
Disclaimer: I did not test that code, so minor adjustments may be needed.
>
> On Monday, June 1, 2015 at 3:29:19 PM UTC-4, Pascal Lamblin wrote:
> >
> > On Mon, Jun 01, 2015, Vincent Alexander Saulys wrote:
> > > I suspect this has to do with how the data is transformed during
> > training
> > > into a series of images. My questions are the following:
> > > How does the dataset get transformed during training?
> > > Why does it not get transformed during fprop?
> > > How can I transform the data to fit what its expect?
> >
> > The model expects the variables passed through fprop to be transformed
> > in the appropriate space already. The reshaping from whatever format the
> > data was in, to whatever the model needs, is usually done in the dataset
> > iterator.
> >
> > To know which format the model needs, you can use `get_input_space()`.
> > To make your dataset iterator spit out data in that format, you can
> > build a data_specs using that space, and assuming you are using a
> > standard Dataset object, the iterator should take care of it.
> >
> > Please let us know if you need more in-depth information,
> >
> > --
> > Pascal
> >
>
--
Pascal