Skip to content

Commit

Permalink
DS-3138: replace tail with Last
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyapcc committed Nov 9, 2020
1 parent 9d5173b commit a607e93
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: flipMultivariates
Title: Multivariate models
Version: 1.0.6
Version: 1.0.7
Author: Displayr <opensource@displayr.com>
Maintainer: Displayr <opensource@displayr.com>
Description: Multivariate models (e.g. LDA, random forest, SVM) according to the flip Project conventions.
Expand Down Expand Up @@ -30,7 +30,8 @@ Imports:
rhtmlMoonPlot,
tensorflow,
utils,
xgboost (>= 1.1.1.1)
xgboost (>= 1.1.1.1),
verbs
Suggests:
testthat,
flipExampleData
Expand All @@ -46,6 +47,7 @@ Remotes:
Displayr/flipChartBasics,
Displayr/rhtmlHeatmap,
Displayr/rhtmlLabeledScatter,
Displayr/rhtmlMoonPlot
RoxygenNote: 7.1.0
Displayr/rhtmlMoonPlot,
Displayr/verbs
RoxygenNote: 7.1.1
Encoding: UTF-8
6 changes: 4 additions & 2 deletions tests/testthat/test-randomforest.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
context("Random Forest")

library(verbs)

test_that("CE-676 Incorrect error about missing values",{
data(colas, package = "flipExampleData")
expect_error(suppressWarnings(RandomForest(d1 ~ q2d, data = colas)), NA)
Expand Down Expand Up @@ -170,14 +172,14 @@ test_that("Weighted versus unweighted results",
D = factor(round(runif(n)*5)),
wgt = runif(n)/100 + .995)
out = RandomForest(dep ~ A + B + C + D, data = df)
expect_equal(tail(out$original$rsq, 1), -0.1332517, tol = 0.00001)
expect_equal(Last(out$original$rsq, 1), -0.1332517, tol = 0.00001)
expect_warning(RandomForest(dep ~ A + B + C + D, data = df), NA)
# The weighted sample causes the measures of accuracy to be
# very optimistic: https://stats.stackexchange.com/a/166492
w <- capture_warnings(out <- RandomForest(dep ~ A + B + C + D, data = df, weights = df$wgt))
expect_match(w[1], "are overly optimistic when a weight")
expect_match(w[2], "Weights have been applied")
expect_equal(tail(out$original$rsq, 1), 0.392224, tol = 0.00001)
expect_equal(Last(out$original$rsq, 1), 0.392224, tol = 0.00001)
})

test_that("DS-2766: check that output doesn't get too big",
Expand Down

0 comments on commit a607e93

Please sign in to comment.