我想用R中的多层感知器来训练我的数据,然后看看评估结果,比如'auc score‘。在R中有一个名为"monmlp“的包,但是我不知道如何正确使用它。
我写了下面的代码
> mlp.model = monmlp.fit(x, y, hidden1=3, n.ensemble=15, monotone=1, bag=T)
** Ensemble 1
** Bagging on
1 0.9206784
** 0.9206784
** Ensemble 2
** Bagging on
1 0.8200886
** 0.8200886
** Ensemble 3
** Bagging on
1 0.8278868
** 0.8278868
.
.
.
** Ensemble 15
** Bagging on
1 0.8186057
** 0.8186057
mlp.pred <- monmlp.predict(x = x, weights = mlp.model)到目前为止还可以,但是下一步是什么呢?例如,我如何找到auc分数?
谢谢..
发布于 2013-04-26 16:20:45
按照Machine learning task view的建议,您可以使用ROCR包。
# Sample data
library(monmlp)
n <- 1000
k <- 7
x <- matrix( rnorm(k*n), nr=n )
w <- rnorm(k)
y <- ifelse( logistic( x %*% w ) + rnorm(n, sd = 0.2) > 1, 0, 1 )
# Fit the model and compute the predictions
r <- monmlp.fit(x, y, hidden1=3, n.ensemble=15, monotone=1, bag=TRUE)
z <- monmlp.predict(x = x, weights = r)
# Compute the AUC
library(ROCR)
plot( performance( prediction( z, y ), "tpr","fpr" ) )
performance( prediction( z, y ), "auc" )@y.values[[1]]https://stackoverflow.com/questions/16228954
复制相似问题