-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporating binary labels into kernel distance #133
Comments
|
@gtng92 pointed out that the kernel distance can be called on trees |
Deleted deprecated config parsing code from smcConfig.R Eliminated caching of "self" kernel scores to trees in treekernel.R
Please write unit tests to check whether labeled kernel function is behaving properly before closing |
On branch tree.kernel <- function(tree1, tree2,
lambda, # decay factor
sigma, # RBF variance parameter
rho=1.0, # SST control parameter; 0 = subtree kernel, 1 = subset tree kernel
normalize=0, # normalize kernel score by sqrt(k(t1,t1) * k(t2,t2))
regexPattern="", # arguments for labeled tree kernel
regexReplacement="",
gamma=0 # label factor
) {
# make labels
use.label <- if (any(is.na(label1)) || any(is.na(label2)) || is.null(label1) || is.null(label2)) {
FALSE
} else {
new_label1 <- gsub(regexPattern, regexReplacement, tree1$tip.label)
new_label2 <- gsub(regexPattern, regexReplacement, tree2$tip.label)
TRUE
}
nwk1 <- .to.newick(tree1)
nwk2 <- .to.newick(tree2)
res <- .Call("R_Kaphi_kernel",
nwk1, nwk2, lambda, sigma, as.double(rho), use.label, gamma, normalize,
PACKAGE="Kaphi")
return (res)
} We want to make these changes:
|
|
On branch
|
We want to refactor the kernel to encode labels in each node's production. Whereas before productions can only take one of four values (0 for terminal node, 1 for node with two non-terminal descendants, etc.), we now want to have each internal node have a tuple (pair) of integers for productions, and reserve the integer value |
New labeled kernel is being prototyped in Python, see PoonLab/coevolution |
Need to port Python implementation into R |
No description provided.
The text was updated successfully, but these errors were encountered: