Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ Authors@R:
role = c("aut", "cre"),
email = "genta.kik@gmail.com")
Description: R implementation of LiNGAM algorithms based on Python implementation (The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam).
License: GPL-3
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.3.2
Imports:
lars,
DiagrammeR,
glmnet,
clue,
fastICA
fastICA,
stats
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2020
YEAR: 2025
COPYRIGHT HOLDER: G. Kikuchi
616 changes: 21 additions & 595 deletions LICENSE.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export(plot_adjacency_mat)
import(DiagrammeR)
importFrom(clue,solve_LSAP)
importFrom(fastICA,fastICA)
importFrom(glmnet,cv.glmnet)
importFrom(lars,lars)
1 change: 1 addition & 0 deletions R/BaseLiNGAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#' This code is based on Python implementation:
#'
#' (The LiNGAM Project: https://sites.google.com/site/sshimizu06/lingam)
#' @importFrom glmnet cv.glmnet
#' @importFrom lars lars
#' @export
BaseLiNGAM <- R6::R6Class("LiNGAM",
Expand Down
12 changes: 6 additions & 6 deletions R/ICALiNGAM.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ ICALiNGAM <- R6::R6Class("ICALiNGAM", inherit = BaseLiNGAM,
fit = function(X) {

# obtain unmixing matrix W_ica
ica <- fastICA(X,
n.comp = ncol(X),
alg.typ = "parallel",
maxit = self$max_iter,
fun = "logcosh"
ica <- fastICA::fastICA(X,
n.comp = ncol(X),
alg.typ = "parallel",
maxit = self$max_iter,
fun = "logcosh"
)
W_ica <- (ica$K %*% ica$W)

# obtain permuted W_ica
# note that W_ica is t(W_ica) of scipy's fastICA
linassign <- solve_LSAP(1 / abs(W_ica), maximum = FALSE)
linassign <- clue::solve_LSAP(1 / abs(W_ica), maximum = FALSE)
col_index <- unname(linassign)
PW_ica <- t(W_ica[, col_index])

Expand Down
12 changes: 6 additions & 6 deletions R/gen_dummy_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#' @export
gen_dummy_data <- function(num_samples = 10000, random_state = 1) {
set.seed(random_state)
x3 <- runif(n = num_samples)
x0 <- runif(n = num_samples) + 3 * x3
x2 <- runif(n = num_samples) + 6 * x3
x1 <- runif(n = num_samples) + 3 * x0 + 2 * x2
x5 <- runif(n = num_samples) + 4 * x0
x4 <- runif(n = num_samples) + 8 * x0 - 1 * x2
x3 <- stats::runif(n = num_samples)
x0 <- stats::runif(n = num_samples) + 3 * x3
x2 <- stats::runif(n = num_samples) + 6 * x3
x1 <- stats::runif(n = num_samples) + 3 * x0 + 2 * x2
x5 <- stats::runif(n = num_samples) + 4 * x0
x4 <- stats::runif(n = num_samples) + 8 * x0 - 1 * x2
X <- data.frame(x0, x1, x2, x3, x4, x5)
return(X)
}
5 changes: 2 additions & 3 deletions R/plot_adjacency_mat.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ plot_adjacency_mat <- function(adj_mat,

}
}
dot <- DiagrammeR::render_graph(graph, layout = "dot", title = title)
dot$x$diagram <- gsub("neato", "dot", dot$x$diagram)
print(DiagrammeR::grViz(dot$x$diagram))

DiagrammeR::render_graph(graph, layout = "neato", title = title)
}
30 changes: 15 additions & 15 deletions man/BaseLiNGAM.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 33 additions & 33 deletions man/DirectLiNGAM.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 26 additions & 26 deletions man/ICALiNGAM.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.