Python 在Theano中实现顺序回归
我想在Theano中实现。但我不知道如何实现中间部分:阈值定义和使用 例如(简单地说): 我注意到Python 在Theano中实现顺序回归,python,machine-learning,deep-learning,theano,Python,Machine Learning,Deep Learning,Theano,我想在Theano中实现。但我不知道如何实现中间部分:阈值定义和使用 例如(简单地说): 我注意到p_y_x和p的定义可能有问题。但我不知道如何修改它。有人能帮忙吗 X = T.matrix('X', dtype='float32') # Feature matrix y = T.vector('y', dtype='int32') # labels w = T.vector('w', dtype='float32') threshold = T.vector('threshold', dty
p_y_x
和p
的定义可能有问题。但我不知道如何修改它。有人能帮忙吗
X = T.matrix('X', dtype='float32') # Feature matrix
y = T.vector('y', dtype='int32') # labels
w = T.vector('w', dtype='float32')
threshold = T.vector('threshold', dtype='float32')
p = T.nnet.sigmoid(threshold - T.dot(X, w))
p_y_x = theano.ifelse.ifelse(T.eq(y, 0), p[y], (p[y] - p[y-1]))
loss = -T.sum(T.log(p_y_x))