找回密码
 注册
查看: 677|回复: 0

R语言 MLInterfaces包 xvalLoop()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-26 01:05:11 | 显示全部楼层 |阅读模式
xvalLoop(MLInterfaces)
xvalLoop()所属R语言包:MLInterfaces

                                        Cross-validation in clustered computing environments
                                         在聚类计算环境的交叉验证

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Use cross-validation in a clustered computing environment
在聚类计算环境中使用交叉验证


用法----------Usage----------


xvalLoop( cluster, ... )



参数----------Arguments----------

参数:cluster
Any S4-class object, used to indicate how to perform clustered computations.
任何S4级的对象,用来指示如何执行聚类计算。


参数:...
Additional arguments used to inform the clustered computation.
额外的参数,用来告知聚类计算。


Details

详情----------Details----------

Cross-validiation usually involves repeated calls to the same function, but with different arguments. This provides an obvious place for using clustered computers to enhance execution. The method xval is structured to exploit this; xvalLoop provides an easy mechanism to change how xval performs cross-validation.
跨-validiation的通常涉及多次调用相同的功能,但不同的参数。这提供了一个明显的地方使用聚类计算机,以提高执行。方法XVAL结构利用此xvalLoop提供了一个方便的机制来改变如何xval执行交叉验证。

The idea is to write an xvalLoop method that returns a function. The function is then used to execute the cross-validation. For instance, the default method returns the function lapply, so the cross-validation is performed by using lapply. A different method might return a function that executed lapply-like functions, but sent different parts of the function to different computer nodes.
我们的想法是写一个xvalLoop方法返回一个函数。然后,该函数用于执行交叉验证。例如,默认的方法返回的功能lapply,所以交叉验证是通过使用lapply执行。不同的方法可能会返回一个执行lapply,像功能的作用,但不同部位的功能发送到不同的电脑节点。

An accompanying vignette illustrates the technique in greater detail. An effective division of labor is for experienced cluster programmers to write lapply-like methods for their favored clustering environment. The user then only has to add the cluster object to the list of arguments to xval to get clustered calculations.
一位随行的小插曲说明了更详细的技术。一个有效的分工,是为有经验的聚类程序员写lapply样的方法,他们青睐的聚类环境。然后,用户只添加聚类对象的xval聚类计算的参数列表。


值----------Value----------

A function taking arguments like those for lapply
函数lapply参数


举例----------Examples----------


## Not run: [#无法运行:]
library(golubEsets)
data(Golub_Merge)
smallG <- Golub_Merge[200:250,]

# Evaluation on one node[在一个节点上的评价]

lk1 <- xval(smallG, "ALL.AML", knnB, xvalMethod="LOO", group=as.integer(0))
table(lk1,smallG$ALL.AML)

# Evaluation on several nodes -- a cluster programmer might write the following...[在多个节点上的评价 - 聚类程序员可能写出下面的...]

library(snow)
setOldClass("spawnedMPIcluster")

setMethod("xvalLoop", signature( cluster = "spawnedMPIcluster"),
## use the function returned below to evalutae[#使用该函数返回到evalutae]
## the central cross-validation loop in xval[#中央循环交叉验证XVAL]
function( cluster, ... ) {
    clusterExportEnv <- function (cl, env = .GlobalEnv)
    {
        unpackEnv <- function(env) {
            for ( name in ls(env) ) assign(name, get(name, env), .GlobalEnv )
            NULL
        }
        clusterCall(cl, unpackEnv, env)
    }
    function(X, FUN, ...) { # this gets returned to xval[这被返回到XVAL]
        ## send all visible variables from the parent (i.e., xval) frame[#从父(即XVAL)帧发送的所有可见变量]
        clusterExportEnv( cluster, parent.frame(1) )
        parLapply( cluster, X, FUN, ... )
    }
})

# ... and use the cluster like this...[...使用这样的聚类...]

cl <- makeCluster(2, "MPI")
clusterEvalQ(cl, library(MLInterfaces))

lk1 <- xval(smallG, "ALL.AML", knnB, xvalMethod="LOO", group=as.integer(0), cluster = cl)
table(lk1,smallG$ALL.AML)


转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-2-3 07:20 , Processed in 0.022570 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表