Skip to content

Re-implementation of kernel in native R failing unit tests #143

@ArtPoon

Description

@ArtPoon

To repro:

require(Kaphi)
require(igraph)  # need to add this as package dependency
    config <- list(
        dist='Kaphi::kernel.dist(x, y, decay.factor=0.5, rbf.variance=2.5, sst.control=1, norm.mode=NONE)',
        decay.factor=0.5,
        rbf.variance=2.5,
        sst.control=1.0,
        norm.mode="NONE"
    )
    nwk.1 <- "(t4:0.2848235269,t3:0.2848235269);"
    nwk.2 <- "(t1:0.04204444404,t2:0.04204444404);"
    tr1 <- parse.input.tree(nwk.1, config)
    tr2 <- parse.input.tree(nwk.2, config)

    delta.1 <- 0.5 * exp(-2*(0.2848235269-0.04204444404)^2/2.5) * (1+0.5) * (1+0.5)
    result <- utk(tr1, tr2, config)
# delta.1 == result passes

    nwk.1 <- "((t4:0.2848235269,t3:0.2848235269):0.6005581596,t1:0.8853816865);"
    nwk.2 <- "((t1:0.04204444404,t2:0.04204444404):1.28616494,t3:1.328209384);"
    tr1 <- parse.input.tree(nwk.1, config)
    tr2 <- parse.input.tree(nwk.2, config)

    result <- utk(tr1, tr2, config)
    delta.2 <- 0.5 * exp(-((0.6005581596-1.28616494)^2+(0.8853816865-1.328209384)^2)/2.5) * (1+delta.1) * (1+0.5)
    expected <- delta.1 + delta.2

# expected == result fails (2.264361 and 1.689797, respectively)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions