Using aggregators
1
0
Entering edit mode
@craddock-richard-c-cdcncidvr-ctr-1816
Last seen 10.1 years ago
Hello all, I am having an issue with using an aggregator. My goal is to perform cross validation on several different datasets. I would like to use an aggregator to keep track of the results from a single dataset, but not across datasets. Here is the code that I have written: for(i in 1:niters) { agg<-new("aggregator") fs<-fsCV( data[,i], gfun, class[,i], agg) rm( agg ) } The problem is that every time I run the line agg<-new("aggregator") it returns the old aggregator. So I end up aggregating the results across datasets, which I do not want to do. What am I missing here? Is there a function for clearing the aggregator? I haven't been able to find one. Thanks, Cameron
• 610 views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 11 weeks ago
United States
Hi Richard -- Not really a pro on using aggregator, but I'm guessing that what you'd like to do is agg <- new("aggregator", aggenv=new.env(parent=emptyenv())) 'aggenv' is where the aggregated data gets stored. It's a data structure called an 'environment'. What the line above does is create a new environment each time you create a 'new' aggregator. Hope this helps. Martin "Craddock, Richard C. (CDC/CCID/NCZVED) (CTR)" <cmi5 at="" cdc.gov=""> writes: > Hello all, > > I am having an issue with using an aggregator. My goal is to perform > cross validation on several different datasets. I would like to use an > aggregator to keep track of the results from a single dataset, but not > across datasets. > > Here is the code that I have written: > > for(i in 1:niters) > { > agg<-new("aggregator") > fs<-fsCV( data[,i], gfun, class[,i], agg) > rm( agg ) > } > > The problem is that every time I run the line agg<-new("aggregator") it > returns the old aggregator. So I end up aggregating the results across > datasets, which I do not want to do. > > What am I missing here? Is there a function for clearing the > aggregator? I haven't been able to find one. > > Thanks, > Cameron > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin T. Morgan Bioconductor / Computational Biology http://bioconductor.org
ADD COMMENT

Login before adding your answer.

Traffic: 573 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6