Skip to content

Commit

Permalink
Merge pull request #20 from brunocarlin/update-docs
Browse files Browse the repository at this point in the history
update docs to use bake and all_numeric_predictors
  • Loading branch information
brunocarlin authored Apr 5, 2022
2 parents cd415d7 + ecc3014 commit 888e895
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 71 deletions.
6 changes: 3 additions & 3 deletions R/ecdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_ecdf(everything()) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 1)
#' tidy(rec, number = 1)
step_outliers_ecdf <- function(recipe,
...,
role = NA,
Expand Down
8 changes: 4 additions & 4 deletions R/h2o.extendedIsolationForest.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_h2o.extendedIsolationForest(all_numeric(), -all_outcomes()) %>%
#' step_outliers_h2o.extendedIsolationForest(all_predictors()) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 1)
#' tidy(rec, number = 1)
step_outliers_h2o.extendedIsolationForest <- function(recipe,
...,
role = NA,
Expand Down
8 changes: 4 additions & 4 deletions R/lookout.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_lookout(all_numeric(), -all_outcomes()) %>%
#' step_outliers_lookout(all_numeric_predictors()) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 1)
#' tidy(rec, number = 1)
step_outliers_lookout <- function(recipe,
...,
role = NA,
Expand Down
8 changes: 4 additions & 4 deletions R/maha.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_maha(all_numeric(), -all_outcomes()) %>%
#' step_outliers_maha(all_numeric_predictors()) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 1)
#' tidy(rec, number = 1)
step_outliers_maha <- function(recipe,
...,
role = NA,
Expand Down
8 changes: 4 additions & 4 deletions R/outForest.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_outForest(all_numeric(), -all_outcomes()) %>%
#' step_outliers_outForest(all_numeric_predictors()) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 1)
#' tidy(rec, number = 1)
step_outliers_outForest <- function(recipe,
...,
role = NA,
Expand Down
8 changes: 4 additions & 4 deletions R/remove.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_maha(all_numeric(), -all_outcomes()) %>%
#' step_outliers_maha(all_numeric_predictors()) %>%
#' step_outliers_remove(contains(r"(.outliers)")) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 2)
#' tidy(rec, number = 2)
step_outliers_remove <- function(recipe,
...,
aggregation_function = mean,
Expand Down
8 changes: 4 additions & 4 deletions R/univariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
#' @examples
#' library(recipes)
#' library(tidy.outliers)
#' rec_obj <-
#' rec <-
#' recipe(mpg ~ ., data = mtcars) %>%
#' step_outliers_univariate(all_numeric(), -all_outcomes()) %>%
#' step_outliers_univariate(all_numeric_predictors()) %>%
#' prep(mtcars)
#'
#' juice(rec_obj)
#' bake(rec, new_data = NULL)
#'
#' tidy(rec_obj, number = 1)
#' tidy(rec, number = 1)
step_outliers_univariate <- function(recipe,
...,
role = NA,
Expand Down
6 changes: 3 additions & 3 deletions man/step_outliers_ecdf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/step_outliers_h2o.extendedIsolationForest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/step_outliers_lookout.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/step_outliers_maha.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/step_outliers_outForest.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/step_outliers_remove.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/step_outliers_univariate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tests/testthat/test-h2o.extendedIsolationForest.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ library(tidy.outliers)

rec_obj <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_h2o.extendedIsolationForest(-all_outcomes(),init_options = list(nthreads = 2)) %>%
step_outliers_h2o.extendedIsolationForest(all_predictors(),init_options = list(nthreads = 2)) %>%
prep(mtcars)


Expand Down Expand Up @@ -42,7 +42,7 @@ test_that("tidy probs work", {

tidy_rec_obj_not_prep <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_h2o.extendedIsolationForest(-all_outcomes()) %>%
step_outliers_h2o.extendedIsolationForest(all_predictors()) %>%
tidy(number = 1)

test_that("tidy probs go to NA", {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-lookout.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ library(tidy.outliers)

rec_obj <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_lookout(all_numeric(), -all_outcomes()) %>%
step_outliers_lookout(all_numeric_predictors()) %>%
prep(mtcars)


Expand Down Expand Up @@ -41,7 +41,7 @@ test_that("tidy probs work", {

tidy_rec_obj_not_prep <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_lookout(all_numeric(), -all_outcomes()) %>%
step_outliers_lookout(all_numeric_predictors()) %>%
tidy(number = 1)

test_that("tidy probs go to NA", {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-maha.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ library(tidy.outliers)

rec_obj <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_maha(all_numeric(), -all_outcomes()) %>%
step_outliers_maha(all_numeric_predictors()) %>%
prep(mtcars)


Expand Down Expand Up @@ -41,7 +41,7 @@ test_that("tidy probs work", {

tidy_rec_obj_not_prep <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_maha(all_numeric(), -all_outcomes()) %>%
step_outliers_maha(all_numeric_predictors()) %>%
tidy(number = 1)

test_that("tidy probs go to NA", {
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-outForest.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ library(tidy.outliers)

rec_obj <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_outForest(all_numeric(), -all_outcomes()) %>%
step_outliers_outForest(all_numeric_predictors()) %>%
prep(mtcars)

juice_result <- juice(rec_obj)
Expand Down Expand Up @@ -41,7 +41,7 @@ test_that("tidy probs work", {

tidy_rec_obj_not_prep <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_outForest(all_numeric(), -all_outcomes()) %>%
step_outliers_outForest(all_numeric_predictors()) %>%
tidy(number = 1)

test_that("tidy probs go to NA", {
Expand All @@ -54,7 +54,7 @@ test_that("tidy probs go to NA", {

rec_obj_original_result <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_outForest(all_numeric(), -all_outcomes(), original_result = TRUE) %>%
step_outliers_outForest(all_numeric_predictors(), original_result = TRUE) %>%
prep(mtcars)

tibbles_to_test_original_result <- rec_obj_original_result |>
Expand All @@ -78,7 +78,7 @@ test_that("orignal result is return valid results", {

rec_obj_outlier_score_function <-
recipe(mpg ~ ., data = mtcars) %>%
step_outliers_outForest(all_numeric(), -all_outcomes(), outlier_score_function = \(x) {
step_outliers_outForest(all_numeric_predictors(), outlier_score_function = \(x) {
sum(x) / sum(x)
}) %>%
prep(mtcars)
Expand Down
Loading

0 comments on commit 888e895

Please sign in to comment.