Linear Regression Lasagne / Theano
<p>I'm trying to make a simple multivariate linear Regression with Lasagne.
This is my Input:</p>

<pre><code>x_train = np.array([[37.93, 139.5, 329., 16.64,
                    16.81, 16.57, 1., 707.,
                    39.72, 149.25, 352.25, 16.61,
                    16.91, 16.60, 40.11, 151.5,
                    361.75, 16.95, 16.98, 16.79]]).astype(np.float32)
y_train = np.array([37.92, 138.25, 324.66, 16.28, 16.27, 16.28]).astype(np.float32)
</code></pre>

<p>For this two data points the network should be able to learn <code>y</code> perfectly.</p>

<p>Here is the model:</p>

<pre><code>i1 = T.matrix()
y = T.vector()
lay1 = lasagne.layers.InputLayer(shape=(None,20),input_var=i1)
out1 = lasagne.layers.get_output(lay1)
lay2 = lasagne.layers.DenseLayer(lay1, 6, nonlinearity=lasagne.nonlinearities.linear)
out2 = lasagne.layers.get_output(lay2)
params = lasagne.layers.get_all_params(lay2, trainable=True)
cost = T.sum(lasagne.objectives.squared_error(out2, y))
grad = T.grad(cost, params)
updates = lasagne.updates.sgd(grad, params, learning_rate=0.1) 
f_train = theano.function([i1, y], [out1, out2, cost], updates=updates)
</code></pre>

<p>After executing multiple times</p>

<pre><code>f_train(x_train,y_train)
</code></pre>

<p>the cost explodes to infinity. Any idea what is going wrong here?</p>

<p>Thanks! </p>