Movatterモバイル変換


[0]ホーム

URL:


rsamplea boot on a green background

R-CMD-checkCodecov test coverageCRAN_Status_BadgeDownloadslifecycle

Overview

The rsample package provides functions to create different types ofresamples and corresponding classes for their analysis. The goal is tohave a modular set of methods that can be used for:

The scope of rsample is to provide the basic building blocks forcreating and analyzing resamples of a data set, but this package doesnot include code for modeling or calculating statistics. TheWorkingwith Resample Sets vignette gives a demonstration of how rsampletools can be used when building models.

Note that resampled data sets created by rsample are directlyaccessible in a resampling object but do not contain much overhead inmemory. Since the original data is not modified, R does not make anautomatic copy.

For example, creating 50 bootstraps of a data set does not create anobject that is 50-fold larger in memory:

library(rsample)library(mlbench)data(LetterRecognition)lobstr::obj_size(LetterRecognition)#> 2,644,640 Bset.seed(35222)boots<-bootstraps(LetterRecognition,times =50)lobstr::obj_size(boots)#> 6,686,776 B# Object size per resamplelobstr::obj_size(boots)/nrow(boots)#> 133,735.5 B# Fold increase is <<< 50as.numeric(lobstr::obj_size(boots)/lobstr::obj_size(LetterRecognition))#> [1] 2.528426

Created on 2022-02-28 by thereprex package(v2.0.1)

The memory usage for 50 bootstrap samples is less than 3-fold morethan the original data set.

Installation

To install it, use:

install.packages("rsample")

And the development version fromGitHub with:

# install.packages("pak")pak::pak("rsample")

Contributing

This project is released with aContributorCode of Conduct. By contributing to this project, you agree to abideby its terms.


[8]ページ先頭

©2009-2025 Movatter.jp