- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 theano 中实现 cox 回归。
我使用逻辑回归教程 (http://deeplearning.net/tutorial/logreg.html) 作为框架,并将逻辑对数似然 (LL) 函数替换为 cox 回归 LL 函数 (https://en.wikipedia.org/wiki/Proportional_hazards_model#The_partial_likelihood)。
这是我目前所拥有的:
class CoxRegression(object):
def __init__(self, x, n_in):
self.W = theano.shared(value=numpy.zeros(n_in,dtype=theano.config.floatX), name='W',borrow=True)
self.b = theano.shared(numpy.cast['float64'](0), borrow=True)
self.theta = T.dot(x, self.W) + self.b
self.exp_theta = T.exp(self.theta)
self.params = [self.W, self.b]
self.x = x
def negative_log_likelihood(self, ytime, ystatus):
LL_i = T.switch(T.eq(ystatus[i],1), self.theta - T.log(T.sum(self.exp_theta * T.gt(ytime, ytime[i]))),0)
基本上,我需要对 LL_i(其中 i 是 0 到 ytime.shape - 1)求和。但我不确定该怎么做。我应该使用扫描功能吗?
最佳答案
想通了。诀窍不是使用扫描函数,而是将双重求和转换为纯矩阵运算。
关于python - theano 中的负对数似然(cox 回归),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32341493/
在 xgboost 0.81 中 cox ph 生存模型的新实现中,如何指定事件的开始和结束时间? 谢谢 例如,R 等效函数是: cph_mod = coxph(Surv(Start, Stop, S
我正在尝试运行一个具有时间交互变量的非比例 cox 回归模型,如 Singer 和 Willett 所著的应用纵向数据分析 第 15 章(第 15.3 节)所述。但是我似乎无法得到与这本书一致的答案。
您好,我正在使用生命线包进行 Cox 回归。我想检查非二元分类变量的影响。有内置的方法吗?或者我应该将每个类别因子转换为一个数字?或者,在生命线中使用 kmf fitter,是否可以对每个因素执行此操
我有以下模型: coxph(Surv(fulength, mortality == 1) ~ pspline(predictor)) 其中 fulength 是随访时间(包括死亡率),predicto
我建立了一个生存 cox 模型,其中包括一个 covariate * time相互作用(检测到非比例性)。 我现在想知道如何才能最轻松地从我的模型中获得生存预测。 我的模型被指定: coxph(for
我有一个带有 5 个时间相关变量和 2 个时间独立变量的 coxph 模型。我想使用 cox.zph 测试比例风险假设以及鞅和偏差残差。我的问题是,这个函数如何处理与时间相关的协变量? 阅读 Gran
cellphone = read.csv("/Users/crystalchau/Desktop/UICT-CELL_IND.csv", nrows = 25, colClasses = c(NA,N
我需要为几个变量运行cox回归模型,所以我想写一个循环来实现它。但它无论如何都行不通。下面是我使用的代码 names(Gen) varlist <- names(hsb2)[8:11] ## get
Python中有生存分析的包吗?具体来说,我有兴趣执行 Cox 回归? 我知道这个example但它在 R 中。我们可以将 Python 与 R 连接起来吗(例如,使用 rpy2 )? 最佳答案 Py
早上好, 在匹配案例/对照研究后,我一直试图在 R 中进行分层逻辑回归,但遇到了我认为意外的错误。我使用 mtcars 数据集重现了错误: test=mtcars test$am=as.factor(
我正在对竞争风险比例风险模型进行交叉验证。在 mstate 的帮助下pacakge,我已经准备好我的数据并且正在用 survival::coxph 拟合它.我为我的训练数据获得了一个拟合的 Cox 模
有谁知道似然比检验,如 lmtest 包中的 lrtest ,它适用于使用 coxph 生成的 cox 比例风险模型? lrtest 似乎不适用于 coxph 模型。 谢谢 最佳答案 pkg:surv
我有一个 Cox 回归,它使用 strata() 和一个 tt()。 是否有任何软件包可以帮助以表格格式生成美观、信息丰富的结果输出?虽然 ggforest() 处理 tt(),但它不处理 strat
我有一个 Cox 回归,它使用 strata() 和一个 tt()。 是否有任何软件包可以帮助以表格格式生成美观、信息丰富的结果输出?虽然 ggforest() 处理 tt(),但它不处理 strat
我正在尝试在 theano 中实现 cox 回归。 我使用逻辑回归教程 (http://deeplearning.net/tutorial/logreg.html) 作为框架,并将逻辑对数似然 (LL
我正在使用 SciPy's boxcox function执行 Box-Cox transformation在一个连续变量上。 from scipy.stats import boxcox impor
我正在使用生存包在 R 中进行分层 cox 回归: cox <- coxph(response~strata(x), data=data) 这很好用,但是当使用 sampling 包时,surviva
在 R 中运行 Cox PH 回归后,我需要在数据框中添加预测风险比的列。数据框是面板数据,其中 numgvkey 如果公司标识符和年龄是时间标识符。您可以从此链接下载日期的一小部分: https:/
我在 R 中使用以下代码建立了一个 Cox 比例风险模型,该模型可以预测死亡率。添加协变量 A、B 和 C 只是为了避免混淆(即年龄、性别、种族),但我们真正对预测变量 X 感兴趣。X 是一个连续变量
我想通过计算方差膨胀因子 (VIF) 来评估 cox 比例风险模型中的多重共线性。 {car} 等包中的 vif 函数不接受 coxph 对象。 有没有办法计算 R 中 cox 模型的 VIF? 最佳
我是一名优秀的程序员,十分优秀!