Skip to content

Commit

Permalink
fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Jan 17, 2025
1 parent aa88866 commit 77d961a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions R/Imputation.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ simpleImpute <- function(trainData, featureEngineeringSettings, done = FALSE) {
start <- Sys.time()
if (!done) {
ParallelLogger::logInfo("Imputing missing values with simpleImputer using: ",
featureEngineeringSettings$method, "and missing threshold: ",
featureEngineeringSettings$method, " and missing threshold: ",
featureEngineeringSettings$missingThreshold)
outputData <- list(
labels = trainData$labels,
Expand Down Expand Up @@ -177,7 +177,7 @@ simpleImpute <- function(trainData, featureEngineeringSettings, done = FALSE) {
done <- TRUE
} else {
ParallelLogger::logInfo("Applying imputation to test data with simpleImputer
using method: ", featureEngineeringSettings$method, "and missing threshold: ",
using method: ", featureEngineeringSettings$method, " and missing threshold: ",
featureEngineeringSettings$missingThreshold)
outputData <- list(
labels = trainData$labels,
Expand Down Expand Up @@ -315,7 +315,7 @@ iterativeImpute <- function(trainData, featureEngineeringSettings, done = FALSE)
done <- TRUE
} else {
ParallelLogger::logInfo("Applying imputation to test data with iterativeImputer
using method: ", featureEngineeringSettings$method, "and missing threshold: ",
using method: ", featureEngineeringSettings$method, " and missing threshold: ",
featureEngineeringSettings$missingThreshold)
outputData <- list(
labels = trainData$labels,
Expand All @@ -336,7 +336,7 @@ iterativeImpute <- function(trainData, featureEngineeringSettings, done = FALSE)
by = "analysisId"
) %>%
dplyr::mutate(isBinary = .data$isBinary == "Y") %>%
dplyr::select(.data$covariateId, .data$isBinary) %>%
dplyr::select("covariateId", "isBinary") %>%
dplyr::compute()
on.exit(outputData$covariateData$covariateIsBinary <- NULL, add = TRUE)
outputData$covariateData$covariates <- outputData$covariateData$covariates %>%
Expand Down
2 changes: 1 addition & 1 deletion R/ParamChecks.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ checkIsClass <- function(parameter, classes) {
checkInStringVector <- function(parameter, values) {
name <- deparse(substitute(parameter))
if (!parameter %in% values) {
ParallelLogger::logError(paste0(name, " should be ", paste0(as.character(values), collapse = "or ")))
ParallelLogger::logError(paste0(name, " should be ", paste0(as.character(values), collapse = " or ")))
stop(paste0(name, " has incorrect value"))
}
return(TRUE)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-featureEngineering.R
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ test_that("normalization works", {
testNormData <- addFeature(testData, 12101, -10, 10)
metaData <- attr(normalizedData$covariateData, "metaData")
testSettings <- metaData$featureEngineering$minMaxNormalize$settings$featureEngineeringSettings
testNormalizedData <- minMaxNormalize(testNormData, testSettings, normalized = TRUE)
testNormalizedData <- minMaxNormalize(testNormData, testSettings, done = TRUE)

feature <- normalizedData$covariateData$covariates %>%
dplyr::filter(.data$covariateId == 12101) %>%
Expand All @@ -375,7 +375,7 @@ test_that("normalization works", {
newTrainData <- robustNormalize(data, normalizer)
metaData <- attr(newTrainData$covariateData, "metaData")
testSettings <- metaData$featureEngineering$robustNormalize$settings$featureEngineeringSettings
newTestData <- robustNormalize(testNormData, testSettings, normalized = TRUE)
newTestData <- robustNormalize(testNormData, testSettings, done = TRUE)
feature <- newTrainData$covariateData$covariates %>%
dplyr::filter(.data$covariateId == 12101) %>%
dplyr::pull(.data$covariateValue)
Expand Down

0 comments on commit 77d961a

Please sign in to comment.