randomiser(made4)
randomiser()所属R语言包:made4
Randomly reassign training and test samples
随机重新分配训练和测试样本
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function is used to check for bias between a training and test data. It return a new index, which randomly re-assigns samples in the training data to the test dataset and vice versa.
此功能用于检查的训练和测试数据之间的偏差。它返回一个新的指数,随机重新分配样本在训练数据测试数据集,反之亦然。
用法----------Usage----------
randomiser(ntrain = 77, ntest = 19)
参数----------Arguments----------
参数:ntrain
Numeric. A integer indicating the number of cases in the training dataset
数字。一个整数,指示的情况下,在训练集
参数:ntest
Numeric. A integer indicating the number of cases in the test dataset
数字。一个整数,指示的情况下,在测试数据集的数量
Details
详情----------Details----------
Produces new indices that can be used for training/test datasets
生产培训/测试数据集,可以使用的新指数
值----------Value----------
It returns a list, containing 2 vectors
它返回一个列表,包含2个向量
参数:train
A vector of length ntrain, which can be used to index a new training dataset
的向量,它可以用来索引一个新的训练集的长度ntrain
参数:test
A vector of length ntest, which can be used to index a new test dataset
一个长度为n测试向量,它可以用来索引一个新的测试数据集
作者(S)----------Author(s)----------
Aedin Culhane
举例----------Examples----------
randomiser(10,5)
train<-matrix(rnorm(400), ncol=20, nrow=20, dimnames=list(1:20,
paste("train",letters[1:20], sep=".")))
test<-matrix(rnorm(200), ncol=10, nrow=20, dimnames=list(1:20,
paste("test",LETTERS[1:10], sep=".")))
all<-cbind(train,test)
colnames(train)
colnames(test)
newInd<-randomiser(ntrain=20, ntest=10)
newtrain<-all[,newInd$train]
newtest<-all[,newInd$test]
colnames(newtrain)
colnames(newtest)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|