Skip to content

Commit 68af10f

Browse files
committed
cvxr correction
1 parent 6516dba commit 68af10f

8 files changed

Lines changed: 24 additions & 14 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: Rdimtools
22
Type: Package
33
Title: Dimension Reduction and Estimation Methods
4-
Version: 1.1.3
4+
Version: 1.1.4
55
Authors@R: c(person("Kisung", "You", role = c("aut", "cre"), email = "kisung.you@outlook.com",comment=c(ORCID="0000-0002-8584-459X")), person("Changhee","Suh",role=c("ctb"),email="cs19bc@my.fsu.edu"), person("Dennis","Shung",role=c("ctb"), email="dennis.shung@yale.edu"))
66
Description: We provide linear and nonlinear dimension reduction techniques.
77
Intrinsic dimension estimation methods for exploratory analysis are also provided.
@@ -12,7 +12,7 @@ LazyData: true
1212
Depends: R (>= 3.0.0)
1313
Imports: ADMM, CVXR (>= 1.0), MASS, RANN, Rcpp (>= 0.12.15), RcppDE, Rdpack, RSpectra, graphics, maotai (>= 0.2.4), mclustcomp, stats, utils
1414
LinkingTo: Rcpp, RcppArmadillo, RcppDist, maotai
15-
RoxygenNote: 7.3.2
15+
RoxygenNote: 7.3.3
1616
RdMacros: Rdpack
1717
URL: https://www.kisungyou.com/Rdimtools/
1818
BugReports: https://github.com/kisungyou/Rdimtools/issues

NAMESPACE

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,19 @@ export(est.packing)
169169
export(est.pcathr)
170170
export(est.twonn)
171171
export(oos.linproj)
172-
import(CVXR)
173172
import(RcppDE)
174173
import(Rdpack)
175174
import(maotai)
176175
importFrom(ADMM,admm.sdp)
176+
importFrom(CVXR,Maximize)
177+
importFrom(CVXR,Minimize)
178+
importFrom(CVXR,Problem)
179+
importFrom(CVXR,Variable)
180+
importFrom(CVXR,matrix_trace)
181+
importFrom(CVXR,norm1)
182+
importFrom(CVXR,p_norm)
183+
importFrom(CVXR,psolve)
184+
importFrom(CVXR,sum_entries)
177185
importFrom(MASS,sammon)
178186
importFrom(RANN,nn2)
179187
importFrom(RSpectra,eigs)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Rdimtools 1.1.4
2+
3+
* Change of `CVXR` package-related routines per its API change.
4+
15
# Rdimtools 1.1.2
26

37
* Fixed an error in `do.lapeig()` thanks to Frithjof Kruggel (UC Irvine).

R/Rdimtools-package.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' @name package-Rdimtools
99
#' @aliases Rdimtools-package
1010
#' @import Rdpack
11-
#' @import CVXR
11+
#' @importFrom CVXR matrix_trace Variable Problem psolve sum_entries norm1 p_norm Minimize Maximize
1212
#' @import RcppDE
1313
#' @import maotai
1414
#' @importFrom RANN nn2

R/linear_DSPP.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#' penalty graph. It follows an integration of global within-class structure into manifold learning
66
#' under exploiting discriminative nature provided from label information.
77
#'
8-
#'
9-
#'
108
#' @param X an \eqn{(n\times p)} matrix or data frame whose rows are observations.
119
#' @param label a length-\eqn{n} vector of data class labels.
1210
#' @param ndim an integer-valued target dimension.
@@ -186,8 +184,8 @@ dspp_compute_wi <- function(xi, Xi, lambda){
186184
si = CVXR::Variable(n)
187185
obj = (CVXR::p_norm(xi-(Xi%*%si),p=2) + lambda*CVXR::p_norm(si,p=1))
188186
constr = list(si>=0)
189-
prob = CVXR::Problem(Minimize(obj), constr)
190-
result = solve(prob)
187+
prob = CVXR::Problem(CVXR::Minimize(obj), constr)
188+
result = CVXR::psolve(prob)
191189
return(as.vector(result$getValue(si)))
192190
}
193191
#' @keywords internal

R/linear_SPP.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ spp_compute_si <- function(xi, Xi, reltol){
112112
si = CVXR::Variable(n)
113113
obj = CVXR::norm1(si)
114114
constr = list(CVXR::p_norm(xi-(Xi%*%si),p=2)<=reltol,(sum(si)==1))
115-
prob = CVXR::Problem(Minimize(obj), constr)
116-
result = solve(prob)
115+
prob = CVXR::Problem(CVXR::Minimize(obj), constr)
116+
result = CVXR::psolve(prob)
117117
return(as.vector(result$getValue(si)))
118118
}

R/nonlinear_MVE.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ do.mve <- function(X, ndim=2, knn=ceiling(nrow(X)/10), kwidth=1.0,
154154
mve_single_cvxr <- function(A, B, C){
155155
N = nrow(B)
156156
Ktmp = CVXR::Variable(N,N,PSD=TRUE)
157-
obj = Maximize(matrix_trace(Ktmp%*%B))
157+
obj = CVXR::Maximize(CVXR::matrix_trace(Ktmp%*%B))
158158
constr1 = list(CVXR::sum_entries(Ktmp)==0)
159159
constr2 = list()
160160
iter = 1
@@ -167,7 +167,7 @@ mve_single_cvxr <- function(A, B, C){
167167
}
168168
}
169169
prob = CVXR::Problem(obj, c(constr1, constr2))
170-
solprob = solve(prob)
170+
solprob = CVXR::psolve(prob)
171171
Knew = as.matrix(solprob$getValue(Ktmp), nrow=N)
172172
return(Knew)
173173
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ plot(mylap$Y, pch=19, col=lab, xlab="LS1", ylab="LS2", main="Laplacian Score")
7171
plot(mydfm$Y, pch=19, col=lab, xlab="DM1", ylab="DM2", main="Diffusion Maps")
7272
```
7373

74-
<img src="man/figures/README-unnamed-chunk-2-1.png" width="90%" style="display: block; margin: auto;" />
74+
<img src="man/figures/README-unnamed-chunk-2-1.png" alt="" width="90%" style="display: block; margin: auto;" />
7575

7676
## Minimal Example : Dimension Estimation
7777

@@ -105,7 +105,7 @@ text(x=xtick, par("usr")[3],
105105
labels = c("Ustat","correlation","made","mle1","twonn"), pos=1, xpd = TRUE)
106106
```
107107

108-
<img src="man/figures/README-unnamed-chunk-3-1.png" width="80%" style="display: block; margin: auto;" />
108+
<img src="man/figures/README-unnamed-chunk-3-1.png" alt="" width="80%" style="display: block; margin: auto;" />
109109

110110
We can observe that all 5 methods we tested estimated the intrinsic
111111
dimension around $d=2$. It should be noted that the estimated dimension

0 commit comments

Comments
 (0)