当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


R recipes tidy.recipe 整理菜谱的结果


tidy 将返回一个数据帧,其中包含有关配方或配方中的操作的信息(当该操作的 tidy 方法存在时)。

用法

# S3 method for step_BoxCox
tidy(x, ...)

# S3 method for step_YeoJohnson
tidy(x, ...)

# S3 method for step_arrange
tidy(x, ...)

# S3 method for step_bin2factor
tidy(x, ...)

# S3 method for step_bs
tidy(x, ...)

# S3 method for step_center
tidy(x, ...)

# S3 method for check_class
tidy(x, ...)

# S3 method for step_classdist
tidy(x, ...)

# S3 method for step_classdist_shrunken
tidy(x, ...)

# S3 method for check_cols
tidy(x, ...)

# S3 method for step_corr
tidy(x, ...)

# S3 method for step_count
tidy(x, ...)

# S3 method for step_cut
tidy(x, ...)

# S3 method for step_date
tidy(x, ...)

# S3 method for step_depth
tidy(x, ...)

# S3 method for step_discretize
tidy(x, ...)

# S3 method for step_dummy
tidy(x, ...)

# S3 method for step_dummy_extract
tidy(x, ...)

# S3 method for step_dummy_multi_choice
tidy(x, ...)

# S3 method for step_factor2string
tidy(x, ...)

# S3 method for step_filter
tidy(x, ...)

# S3 method for step_filter_missing
tidy(x, ...)

# S3 method for step_geodist
tidy(x, ...)

# S3 method for step_harmonic
tidy(x, ...)

# S3 method for step_holiday
tidy(x, ...)

# S3 method for step_hyperbolic
tidy(x, ...)

# S3 method for step_ica
tidy(x, ...)

# S3 method for step_impute_bag
tidy(x, ...)

# S3 method for step_impute_knn
tidy(x, ...)

# S3 method for step_impute_linear
tidy(x, ...)

# S3 method for step_impute_lower
tidy(x, ...)

# S3 method for step_impute_mean
tidy(x, ...)

# S3 method for step_impute_median
tidy(x, ...)

# S3 method for step_impute_mode
tidy(x, ...)

# S3 method for step_impute_roll
tidy(x, ...)

# S3 method for step_indicate_na
tidy(x, ...)

# S3 method for step_integer
tidy(x, ...)

# S3 method for step_interact
tidy(x, ...)

# S3 method for step_intercept
tidy(x, ...)

# S3 method for step_inverse
tidy(x, ...)

# S3 method for step_invlogit
tidy(x, ...)

# S3 method for step_isomap
tidy(x, ...)

# S3 method for step_kpca
tidy(x, ...)

# S3 method for step_kpca_poly
tidy(x, ...)

# S3 method for step_kpca_rbf
tidy(x, ...)

# S3 method for step_lag
tidy(x, ...)

# S3 method for step_lincomb
tidy(x, ...)

# S3 method for step_log
tidy(x, ...)

# S3 method for step_logit
tidy(x, ...)

# S3 method for check_missing
tidy(x, ...)

# S3 method for step_mutate
tidy(x, ...)

# S3 method for step_mutate_at
tidy(x, ...)

# S3 method for step_naomit
tidy(x, ...)

# S3 method for check_new_values
tidy(x, ...)

# S3 method for step_nnmf
tidy(x, ...)

# S3 method for step_nnmf_sparse
tidy(x, ...)

# S3 method for step_normalize
tidy(x, ...)

# S3 method for step_novel
tidy(x, ...)

# S3 method for step_ns
tidy(x, ...)

# S3 method for step_num2factor
tidy(x, ...)

# S3 method for step_nzv
tidy(x, ...)

# S3 method for step_ordinalscore
tidy(x, ...)

# S3 method for step_other
tidy(x, ...)

# S3 method for step_pca
tidy(x, type = "coef", ...)

# S3 method for step_percentile
tidy(x, ...)

# S3 method for step_pls
tidy(x, ...)

# S3 method for step_poly
tidy(x, ...)

# S3 method for step_poly_bernstein
tidy(x, ...)

# S3 method for step_profile
tidy(x, ...)

# S3 method for step_range
tidy(x, ...)

# S3 method for check_range
tidy(x, ...)

# S3 method for step_ratio
tidy(x, ...)

# S3 method for step_regex
tidy(x, ...)

# S3 method for step_relevel
tidy(x, ...)

# S3 method for step_relu
tidy(x, ...)

# S3 method for step_rename
tidy(x, ...)

# S3 method for step_rename_at
tidy(x, ...)

# S3 method for step_rm
tidy(x, ...)

# S3 method for step_sample
tidy(x, ...)

# S3 method for step_scale
tidy(x, ...)

# S3 method for step_select
tidy(x, ...)

# S3 method for step_shuffle
tidy(x, ...)

# S3 method for step_slice
tidy(x, ...)

# S3 method for step_spatialsign
tidy(x, ...)

# S3 method for step_spline_b
tidy(x, ...)

# S3 method for step_spline_convex
tidy(x, ...)

# S3 method for step_spline_monotone
tidy(x, ...)

# S3 method for step_spline_natural
tidy(x, ...)

# S3 method for step_spline_nonnegative
tidy(x, ...)

# S3 method for step_sqrt
tidy(x, ...)

# S3 method for step_string2factor
tidy(x, ...)

# S3 method for recipe
tidy(x, number = NA, id = NA, ...)

# S3 method for step
tidy(x, ...)

# S3 method for check
tidy(x, ...)

# S3 method for step_time
tidy(x, ...)

# S3 method for step_unknown
tidy(x, ...)

# S3 method for step_unorder
tidy(x, ...)

# S3 method for step_window
tidy(x, ...)

# S3 method for step_zv
tidy(x, ...)

参数

x

recipe 对象、步骤或检查(经过训练或以其他方式)。

...

目前未使用。

type

对于 step_pca ,可以是 "coef" (对于每个组件的变量加载)或 "variance" (每个组件占多少方差)。

number

整数或 NA 。如果缺少且未提供id,则返回值是配方中的操作列表。如果给出了一个数字,则为配方中的该操作执行 tidy 方法(如果存在)。如果提供id,则不得提供number

id

字符串或 NA 。如果缺少且未提供number,则返回值是配方中的操作列表。如果给出了字符串,则为配方中的该操作执行 tidy 方法(如果存在)。如果提供number,则不得提供id

一个小标题,其中的列根据执行的 tidy 方法而变化。当 numberidNA 时,包含列 number(操作迭代)、operation("step" 或 "check")、type(方法,例如 "nzv"、"center")、一个名为 trained 的逻辑列(用于确定操作是否已使用 prep 进行估计)、一个逻辑列 skip 以及一个字符列 id

例子

data(Sacramento, package = "modeldata")

Sacramento_rec <- recipe(~., data = Sacramento) %>%
  step_other(all_nominal(), threshold = 0.05, other = "another") %>%
  step_center(all_numeric()) %>%
  step_dummy(all_nominal()) %>%
  check_cols(ends_with("ude"), sqft, price)

tidy(Sacramento_rec)
#> # A tibble: 4 × 6
#>   number operation type   trained skip  id          
#>    <int> <chr>     <chr>  <lgl>   <lgl> <chr>       
#> 1      1 step      other  FALSE   FALSE other_rHEnN 
#> 2      2 step      center FALSE   FALSE center_0byij
#> 3      3 step      dummy  FALSE   FALSE dummy_GJcNB 
#> 4      4 check     cols   FALSE   FALSE cols_IeIAm  

tidy(Sacramento_rec, number = 2)
#> # A tibble: 1 × 3
#>   terms         value id          
#>   <chr>         <dbl> <chr>       
#> 1 all_numeric()    NA center_0byij
tidy(Sacramento_rec, number = 3)
#> # A tibble: 1 × 3
#>   terms         columns id         
#>   <chr>         <chr>   <chr>      
#> 1 all_nominal() NA      dummy_GJcNB

Sacramento_rec_trained <- prep(Sacramento_rec, training = Sacramento)

tidy(Sacramento_rec_trained)
#> # A tibble: 4 × 6
#>   number operation type   trained skip  id          
#>    <int> <chr>     <chr>  <lgl>   <lgl> <chr>       
#> 1      1 step      other  TRUE    FALSE other_rHEnN 
#> 2      2 step      center TRUE    FALSE center_0byij
#> 3      3 step      dummy  TRUE    FALSE dummy_GJcNB 
#> 4      4 check     cols   TRUE    FALSE cols_IeIAm  
tidy(Sacramento_rec_trained, number = 3)
#> # A tibble: 6 × 3
#>   terms columns     id         
#>   <chr> <chr>       <chr>      
#> 1 city  ROSEVILLE   dummy_GJcNB
#> 2 city  SACRAMENTO  dummy_GJcNB
#> 3 city  another     dummy_GJcNB
#> 4 zip   another     dummy_GJcNB
#> 5 type  Residential dummy_GJcNB
#> 6 type  another     dummy_GJcNB
tidy(Sacramento_rec_trained, number = 4)
#> # A tibble: 4 × 2
#>   terms     id        
#>   <chr>     <chr>     
#> 1 latitude  cols_IeIAm
#> 2 longitude cols_IeIAm
#> 3 sqft      cols_IeIAm
#> 4 price     cols_IeIAm

相关用法


注:本文由纯净天空筛选整理自Max Kuhn等大神的英文原创作品 Tidy the Result of a Recipe。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。