0

http://lasagne.readthedocs.org/en/latest/user/tutorial.html#id2

I have tried the following

network_output = lasagne.layers.get_output(network)
f = theano.function([input_var], network_output[:,-1])
y_hat = f(X_train)

however I get NAN for all the samples in Y_hat here.

EDIT: I was able to solve the NAN issue. However now my prediction returns only one class (1)

4

1 回答 1

0

network_output 是一个形状为 (N,K) 的矩阵,其中 N 是数据点的数量,K 是类的数量;它是一个原始分数矩阵。在您的代码中 network_output[:,-1] 将是第 K 个或最后一个标签的所有原始得分值。换句话说,您返回的是一个列向量,而不是整个原始分数矩阵。要输出所有分数,只需将您的 theano.function 修改为:

f = theano.function([input_var], network_output)

并且您应该返回所有原始课程分数。

于 2016-03-22T12:31:55.210 回答