| Title: | Optimal Tensor Transport |
|---|---|
| Description: | An optimal transport (OT) method, which can handle tensors of any order by learning possibly multiple transport plans. For the details of the methods, see Kerdoncuff et al. (2022) <doi:10.1609/aaai.v36i7.20695>. |
| Authors: | Koki Tsuyuzaki [aut, cre] |
| Maintainer: | Koki Tsuyuzaki <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.99.0 |
| Built: | 2026-05-13 12:20:11 UTC |
| Source: | https://github.com/cran/otTensor |
An optimal transport (OT) method, which can handle tensors of any order by learning possibly multiple transport plans. For the details of the methods, see Kerdoncuff et al. (2022) <doi:10.1609/aaai.v36i7.20695>.
The DESCRIPTION file:
| Package: | otTensor |
| Type: | Package |
| Title: | Optimal Tensor Transport |
| Version: | 0.99.0 |
| Authors@R: | c(person("Koki", "Tsuyuzaki", role = c("aut", "cre"), email = "[email protected]")) |
| Depends: | R (>= 3.4.0) |
| Imports: | methods, |
| Suggests: | rTensor, knitr, rmarkdown, testthat |
| Description: | An optimal transport (OT) method, which can handle tensors of any order by learning possibly multiple transport plans. For the details of the methods, see Kerdoncuff et al. (2022) <doi:10.1609/aaai.v36i7.20695>. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/rikenbit/otTensor |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-05-08 11:45:49 UTC; koki |
| Author: | Koki Tsuyuzaki [aut, cre] |
| Maintainer: | Koki Tsuyuzaki <[email protected]> |
| Repository: | https://cran.r-universe.dev |
| Date/Publication: | 2026-05-13 10:47:50 UTC |
| RemoteUrl: | https://github.com/cran/otTensor |
| RemoteRef: | HEAD |
| RemoteSha: | 262c64ef94762da49f1dc990edbcd4c469f4f169 |
Index of help topics:
OTT Optimal Tensor Transport otTensor-package Optimal Tensor Transport
Further information is available in the following vignettes:
otTensor-1 |
Introduction to otTensor (source, pdf) |
otTensor-2 |
Optimal Tensor Transport (source, pdf) |
Koki Tsuyuzaki [aut, cre]
Maintainer: Koki Tsuyuzaki <[email protected]>
Kerdoncuff, T. et al., (2022). Optimal Tensor Transport. Proceedings of the AAAI Conference on Artificial Intelligence, 36(7), 7124-7132.
ls("package:otTensor")ls("package:otTensor")
Transport plans to align two tensors X and Y are estimated.
OTT(X, Y, f, ps=NULL, qs=NULL, loss=.absolute_error, num.sample=1000, num.iter=200, epsilon=1e-10, verbose=FALSE)OTT(X, Y, f, ps=NULL, qs=NULL, loss=.absolute_error, num.sample=1000, num.iter=200, epsilon=1e-10, verbose=FALSE)
X |
The first tensor data ('rTensor' object). The order must be the same as that of Y. |
Y |
The second tensor data ('rTensor' object). The order must be the same as that of X. |
f |
Affectation function to assign transport plan to each pair of mode of X and Y. |
ps |
Row-wise weight vectors for transport plans (Default: NULL, which means uniform distribution). |
qs |
Column-wise weight vectors for transport plans (Default: NULL, which means uniform distribution). |
loss |
Loss function (Default: .absolute_error). |
num.sample |
Number of samples to calculate the gradient (Default: 1000). |
num.iter |
Number of iterations (Default: 200). |
epsilon |
Regularization parameter (Default: 1e-10). |
verbose |
Verbose option (Default: FALSE). |
Ts : A list contains transport plans.
Koki Tsuyuzaki
library("rTensor") D <- 3 A <- 2 Is <- c(4, 4, 5) Ks <- c(6, 6, 7) f <- c(1, 1, 2) arrX <- array(rep(0, prod(Is)), Is) arrY <- array(rep(0, prod(Ks)), Ks) for (i1 in 1:Is[1]) { for (i2 in 1:Is[2]) { for (i3 in 1:Is[3]) { arrX[i1, i2, i3] <- i1 + i2 + i3 } } } for (k1 in 1:Ks[1]) { for (k2 in 1:Ks[2]) { for (k3 in 1:Ks[3]) { arrY[k1, k2, k3] <- k1 + k2 + k3 } } } ps <- list() for (a in 1:A) { ds <- which(f == a) d <- ds[1] length_of_p_a <- dim(arrX)[d] ps[[a]] <- rep(0.01, length_of_p_a); ps[[a]][c(1, 3)] <- 1 ps[[a]] <- ps[[a]] / sum(ps[[a]]) } qs <- list() for (a in 1:A) { ds <- which(f == a) d <- ds[1] length_of_q_a <- dim(arrY)[d] qs[[a]] <- rep(1, length_of_q_a); qs[[a]][c(2, 3)] <- 0 qs[[a]] <- qs[[a]] / sum(qs[[a]]) } # Test Dataset X <- as.tensor(arrX) Y <- as.tensor(arrY) # This is just for an example. # In real data analysis, # please specify larger num.sample and num.iter such as 1000 and 200, respectively. OTT(X = X, Y = Y, f = f, ps=ps, qs=qs, num.sample=10, loss = function (x, y) {abs(x - y)}, num.iter=2, epsilon=1e-10)library("rTensor") D <- 3 A <- 2 Is <- c(4, 4, 5) Ks <- c(6, 6, 7) f <- c(1, 1, 2) arrX <- array(rep(0, prod(Is)), Is) arrY <- array(rep(0, prod(Ks)), Ks) for (i1 in 1:Is[1]) { for (i2 in 1:Is[2]) { for (i3 in 1:Is[3]) { arrX[i1, i2, i3] <- i1 + i2 + i3 } } } for (k1 in 1:Ks[1]) { for (k2 in 1:Ks[2]) { for (k3 in 1:Ks[3]) { arrY[k1, k2, k3] <- k1 + k2 + k3 } } } ps <- list() for (a in 1:A) { ds <- which(f == a) d <- ds[1] length_of_p_a <- dim(arrX)[d] ps[[a]] <- rep(0.01, length_of_p_a); ps[[a]][c(1, 3)] <- 1 ps[[a]] <- ps[[a]] / sum(ps[[a]]) } qs <- list() for (a in 1:A) { ds <- which(f == a) d <- ds[1] length_of_q_a <- dim(arrY)[d] qs[[a]] <- rep(1, length_of_q_a); qs[[a]][c(2, 3)] <- 0 qs[[a]] <- qs[[a]] / sum(qs[[a]]) } # Test Dataset X <- as.tensor(arrX) Y <- as.tensor(arrY) # This is just for an example. # In real data analysis, # please specify larger num.sample and num.iter such as 1000 and 200, respectively. OTT(X = X, Y = Y, f = f, ps=ps, qs=qs, num.sample=10, loss = function (x, y) {abs(x - y)}, num.iter=2, epsilon=1e-10)