Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/314.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Theano中实现顺序回归_Python_Machine Learning_Deep Learning_Theano - Fatal编程技术网

Python 在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

我想在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', 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))