Description Usage Arguments Value References Examples
This function calculates the alternative maximum likelihood estimation for multiple-instance logistic regression through a softmax function (Xu and Frank, 2004; Ray and Craven, 2005).
1 |
y |
a vector. Bag-level binary labels. |
x |
the design matrix. The number of rows of |
bag |
a vector, bag id. |
alpha |
A non-negative realnumber, the softmax parameter. |
... |
arguments to be passed to the |
a list including coefficients and fitted values.
S. Ray, and M. Craven. (2005) Supervised versus multiple instance learning: An empirical comparsion. in Proceedings of the 22nd International Conference on Machine Learnings, ACM, 697–704.
X. Xu, and E. Frank. (2004) Logistic regression and boosting for labeled bags of instances. in Advances in Knowledge Discovery and Data Mining, Springer, 272–281.
1 2 3 4 5 6 7 8 9 10 11 12 13 | set.seed(100)
beta <- runif(10, -5, 5)
trainData <- DGP(40, 3, beta)
testData <- DGP(5, 3, beta)
# Fit softmax-MILR model S(0)
softmax_result <- softmax(trainData$Z, trainData$X, trainData$ID, alpha = 0)
coef(softmax_result) # coefficients
fitted(softmax_result) # fitted bag labels
fitted(softmax_result, type = "instance") # fitted instance labels
predict(softmax_result, testData$X, testData$ID) # predicted bag labels
predict(softmax_result, testData$X, testData$ID, type = "instance") # predicted instance labels
# Fit softmax-MILR model S(3) (not run)
# softmax_result <- softmax(trainData$Z, trainData$X, trainData$ID, alpha = 3)
|
intercept x1 x2 x3 x4 x5 x6 x7
1077.4830 109.5516 -311.3496 -537.8281 -234.4658 -430.8907 916.9267 -226.4520
x8 x9
-116.3242 -749.9585
[1] 0 1 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1
[39] 1 1
[1] 0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0
[38] 0 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1
[75] 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1
[112] 1 1 0 1 1 0 1 1 1
[1] 1 0 1 0 1
[1] 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.