################################################
# Loading data
################################################


dataset_info = load_class_data_batch('/vega/stats/users/sl3368/Data_LC/NopadNormData/LC_stim_5.mat')
stim = dataset_info[0]
data_set_x = theano.shared(stim, borrow=True)


###############################################################
# (Re-Define) Architecture: input --> LSTM --> predict one-ahead
###############################################################

x = T.matrix('x')  # the data is presented as a vector of inputs with many exchangeable examples of this vector
x = clip_gradient(x,1.0)    
is_train = T.iscalar('is_train') # pseudo boolean for switching between training and prediction

rng = numpy.random.RandomState(1234)

# The poisson regression layer gets as input the hidden units
# of the hidden layer
n_hidden = 400;

lstm_1 = LSTM(rng, x, n_in=data_set_x.get_value(borrow=True).shape[1], n_out=n_hidden)

lstm_2 = LSTM(rng, lstm_1.output, n_in=n_hidden, n_out=n_hidden-200)

output = LinearRegression(input=lstm_2.output, n_in=n_hidden-200, n_out=data_set_x.get_value(borrow=True).shape[1])

################################################
Пример #2
0
all_inds = numpy.arange(n_batches)
numpy.random.shuffle(all_inds);
train_inds = all_inds[0:n_train_batches]
val_inds = numpy.arange(n_val_batches)#all_inds[n_train_batches:n_train_batches+n_val_batches] #numpy.random.choice(n_batches,n_val_batches,replace=False)
test_inds = numpy.arange(n_val_batches)+n_val_batches


######################
# BUILD ACTUAL MODEL #
######################
print '... building the model'

# allocate symbolic variables for the data
index = T.lscalar()  # index to a [mini]batch
x = T.matrix('x')  # the data is presented as a vector of inputs with many exchangeable examples of this vector
x = clip_gradient(x,1.0)     
y = T.matrix('y')  # the data is presented as a vector of inputs with many exchangeable examples of this vector

is_train = T.iscalar('is_train') # pseudo boolean for switching between training and prediction

rng = numpy.random.RandomState(1234)

################################################
# Architecture: input --> LSTM --> predict one-ahead
################################################

# The poisson regression layer gets as input the hidden units
# of the hidden layer
#d_input = Dropout(rng, is_train, x)

#nn_lstm = 40