From fe2c10293f08daeaaebb94125f2bf20f0c433aa0 Mon Sep 17 00:00:00 2001 From: Koji Makiyama Date: Sun, 30 Jun 2019 19:55:08 +0900 Subject: [PATCH] for CRAN --- DESCRIPTION | 2 +- R/KLIEP.R | 4 ++-- R/compute_kernel_Gaussian.R | 2 +- README.Rmd | 4 ++-- README.md | 4 ++-- man/KLIEP.Rd | 4 ++-- man/squared_euclid_distance.Rd | 2 +- tests/testthat/test-KLIEP.R | 1 + tests/testthat/test-RuLSIF.R | 1 + tests/testthat/test-uLSIF.R | 1 + vignettes/densratio.Rmd | 2 +- 11 files changed, 15 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3673175..f94ba52 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: densratio Type: Package -Version: 0.2.0 +Version: 0.2.1 Title: Density Ratio Estimation Description: Density ratio estimation. The estimated density ratio function can be used in many applications such as diff --git a/R/KLIEP.R b/R/KLIEP.R index e4cc7cc..f494b81 100644 --- a/R/KLIEP.R +++ b/R/KLIEP.R @@ -4,8 +4,8 @@ #' @param x2 numeric vector or matrix. Data from a denominator distribution q(x). #' @param sigma positive numeric vector. Search range of Gaussian kernel bandwidth. #' @param kernel_num positive integer. Number of kernels. -#' @param fold positive integer. Numer of the folds of cross validation. -#' @param verbose logical(default TRUE). +#' @param fold positive integer. Number of the folds of cross validation. +#' @param verbose logical (default TRUE). #' #' @return KLIEP object that contains a function to compute estimated density ratio. #' diff --git a/R/compute_kernel_Gaussian.R b/R/compute_kernel_Gaussian.R index f440d89..46c3e5b 100644 --- a/R/compute_kernel_Gaussian.R +++ b/R/compute_kernel_Gaussian.R @@ -15,7 +15,7 @@ kernel_Gaussian <- function(x, y, sigma) { #' @param x a numeric vector. #' @param y a numeric vector. #' -#' @return squared euclid distance +#' @return squared Euclid distance squared_euclid_distance <- function(x, y) { sum((x - y) ^ 2) } diff --git a/README.Rmd b/README.Rmd index 0acdff0..18a7705 100644 --- a/README.Rmd +++ b/README.Rmd @@ -24,8 +24,8 @@ library(mvtnorm) [![Travis-CI Build Status](https://travis-ci.org/hoxo-m/densratio.svg?branch=master)](https://travis-ci.org/hoxo-m/densratio) -[![CRAN Version](http://www.r-pkg.org/badges/version/densratio)](https://CRAN.R-project.org/package=densratio) -[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/densratio)](http://cranlogs.r-pkg.org/badges/densratio/) +[![CRAN Version](https://www.r-pkg.org/badges/version/densratio)](https://CRAN.R-project.org/package=densratio) +[![CRAN Downloads](https://cranlogs.r-pkg.org/badges/densratio)](https://CRAN.R-project.org/package=densratio) [![Coverage Status](https://coveralls.io/repos/github/hoxo-m/densratio/badge.svg?branch=master)](https://coveralls.io/github/hoxo-m/densratio?branch=master) [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/hoxo-m) diff --git a/README.md b/README.md index 0bbcbae..506bc0f 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ [![Travis-CI Build Status](https://travis-ci.org/hoxo-m/densratio.svg?branch=master)](https://travis-ci.org/hoxo-m/densratio) [![CRAN -Version](http://www.r-pkg.org/badges/version/densratio)](https://CRAN.R-project.org/package=densratio) +Version](https://www.r-pkg.org/badges/version/densratio)](https://CRAN.R-project.org/package=densratio) [![CRAN -Downloads](http://cranlogs.r-pkg.org/badges/densratio)](http://cranlogs.r-pkg.org/badges/densratio/) +Downloads](https://cranlogs.r-pkg.org/badges/densratio)](https://CRAN.R-project.org/package=densratio) [![Coverage Status](https://coveralls.io/repos/github/hoxo-m/densratio/badge.svg?branch=master)](https://coveralls.io/github/hoxo-m/densratio?branch=master) [![Say diff --git a/man/KLIEP.Rd b/man/KLIEP.Rd index 49f6c1d..56c50f8 100644 --- a/man/KLIEP.Rd +++ b/man/KLIEP.Rd @@ -16,9 +16,9 @@ KLIEP(x1, x2, sigma = "auto", kernel_num = 100, fold = 5, \item{kernel_num}{positive integer. Number of kernels.} -\item{fold}{positive integer. Numer of the folds of cross validation.} +\item{fold}{positive integer. Number of the folds of cross validation.} -\item{verbose}{logical(default TRUE).} +\item{verbose}{logical (default TRUE).} } \value{ KLIEP object that contains a function to compute estimated density ratio. diff --git a/man/squared_euclid_distance.Rd b/man/squared_euclid_distance.Rd index f7c758b..b58a048 100644 --- a/man/squared_euclid_distance.Rd +++ b/man/squared_euclid_distance.Rd @@ -12,7 +12,7 @@ squared_euclid_distance(x, y) \item{y}{a numeric vector.} } \value{ -squared euclid distance +squared Euclid distance } \description{ Compute Squared Euclid Distance diff --git a/tests/testthat/test-KLIEP.R b/tests/testthat/test-KLIEP.R index 1b4494b..4b2bf59 100644 --- a/tests/testthat/test-KLIEP.R +++ b/tests/testthat/test-KLIEP.R @@ -14,6 +14,7 @@ test_that("KLIEP", { expected_kernel_weights <- c(0.0885607375, 0.0178664639, 0.0240389107, 0.0000000000, 0.0810753470, 0.0001353598) + testthat::skip_on_cran() expect_equal(head(kernel_weights), expected_kernel_weights) expect_equal(sigma, 0.09) }) diff --git a/tests/testthat/test-RuLSIF.R b/tests/testthat/test-RuLSIF.R index 82860d0..f72171d 100644 --- a/tests/testthat/test-RuLSIF.R +++ b/tests/testthat/test-RuLSIF.R @@ -14,6 +14,7 @@ test_that("RuLSIF", { expected_kernel_weights <- c(0.070454411, 0.028303149, 0.003146211, 0.010641579, 0.055200243, 0.012069721) + testthat::skip_on_cran() expect_equal(head(kernel_weights), expected_kernel_weights) expect_equal(sigma, 0.1) expect_equal(lambda, 0.1) diff --git a/tests/testthat/test-uLSIF.R b/tests/testthat/test-uLSIF.R index 346a50c..f4d75c8 100644 --- a/tests/testthat/test-uLSIF.R +++ b/tests/testthat/test-uLSIF.R @@ -14,6 +14,7 @@ test_that("uLSIF", { expected_kernel_weights <- c(0.0674550859, 0.0400446153, 0.0004589047, 0.0168489465, 0.0670843163, 0.0189929309) + testthat::skip_on_cran() expect_equal(head(kernel_weights), expected_kernel_weights) expect_equal(sigma, 0.1) expect_equal(lambda, 1) diff --git a/vignettes/densratio.Rmd b/vignettes/densratio.Rmd index 27eb1e6..655814b 100644 --- a/vignettes/densratio.Rmd +++ b/vignettes/densratio.Rmd @@ -25,7 +25,7 @@ $$ where $x1$ and $x2$ are $d$-dimensional real numbers. -The estimated density ratio function $w(x)$ can be used in many applications such as **anomaly detection** [Hido et al. 2011], **changepoint detection** [Liu et al. 2013], and **covariate shift adaptation** [Sugiyama et al. 2007]. +The estimated density ratio function $w(x)$ can be used in many applications such as **anomaly detection** [Hido et al. 2011], **change-point detection** [Liu et al. 2013], and **covariate shift adaptation** [Sugiyama et al. 2007]. Other useful applications about density ratio estimation were summarized by [Sugiyama et al. 2012]. The package **densratio** provides a function `densratio()` that returns an object with a method to estimate density ratio as `compute_density_ratio()`.