-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from hoxo-m/refactoring
Refactoring
- Loading branch information
Showing
20 changed files
with
497 additions
and
319 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
#' @importFrom utils str | ||
#' @export | ||
print.densratio <- function(x, digits = 3L, ...) { | ||
cat("\nCall:\n", paste(deparse(x$call), sep = "\n", collapse = "\n"), | ||
"\n\n", sep = "") | ||
if (!is.null(x$call)) { | ||
cat("\nCall:\n", paste(deparse(x$call), sep = "\n", collapse = "\n"), | ||
"\n\n", sep = "") | ||
} | ||
|
||
info <- x$kernel_info | ||
cat("Kernel Information:\n") | ||
cat(" Kernel type: ", info$kernel, "\n") | ||
cat(" Number of kernels: ", info$kernel_num, "\n") | ||
cat(" Bandwidth(sigma): ", format(info$sigma, digits = digits), "\n") | ||
cat(" Bandwidth (sigma): ", format(info$sigma, digits = digits), "\n") | ||
cat(" Centers: ") | ||
str(info$centers, digits.d = digits, give.attr = FALSE) | ||
cat("\n") | ||
cat("Kernel Weights:\n ") | ||
str(x$kernel_weights, digits.d = digits, give.attr = FALSE) | ||
cat("\n") | ||
|
||
|
||
if("uLSIF" %in% class(x)) { | ||
cat("Kernel Weights:\n ") | ||
str(x$alpha, digits.d = digits, give.attr = FALSE) | ||
cat("\n") | ||
cat("Regularization Parameter(lambda): ", x$lambda, "\n\n") | ||
} | ||
|
||
if("RuLSIF" %in% class(x)) { | ||
cat("Kernel Weights:\n ") | ||
str(x$kernel_weights, digits.d = digits, give.attr = FALSE) | ||
cat("\n") | ||
if ("uLSIF" %in% class(x)) { | ||
cat("Regularization Parameter (lambda): ", x$lambda, "\n\n") | ||
} else if ("RuLSIF" %in% class(x)) { | ||
cat("Regularization Parameter (lambda): ", x$lambda, "\n") | ||
cat("Relative Parameter (alpha): ", x$alpha, "\n\n") | ||
} | ||
|
||
if("KLIEP" %in% class(x)) { | ||
cat("Kernel Weights:\n ") | ||
str(x$alpha, digits.d = digits, give.attr = FALSE) | ||
cat("\n") | ||
} else if ("KLIEP" %in% class(x)) { | ||
cat("Number of the Folds: ", x$fold, "\n\n") | ||
} | ||
|
||
cat("The Function to Estimate Density Ratio:\n") | ||
cat("Function to Estimate Density Ratio:\n") | ||
cat(" compute_density_ratio()\n") | ||
|
||
cat("\n") | ||
invisible(x) | ||
} | ||
|
||
#' @export | ||
print.KLIEP <- print.densratio | ||
|
||
#' @export | ||
print.uLSIF <- print.densratio | ||
|
||
#' @export | ||
print.RuLSIF <- print.densratio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.