stringdotEx {stringkernels}R Documentation

Character-based string kernels

Description

Character-based string kernels, analogous to kernlab's stringdot.

Usage

stringdotEx(type = c("spectrum", "boundrange", "constant", "exponential"), 
    length = 4, lambda = 1.1, normalized = TRUE)

Arguments

type Type of kernel to be used. Four types are supported:
spectrum Matches of exactly length n.
boundrange Matches of all lengths up to n
exponential Matches of all lengths with exponentially decaying weighting lambda ^ (-n).
constant Matches of all lengths with equal weighting.
length Length of the substrings (only for spectrum and boundrange kernels)
lambda Weighting factor, must be > 1 (only for exponential kernel)
normalized Normalize word kernel values (default: TRUE)

Details

This function is identical to the stringdot function in kernlab, but compatible with functions like precomputedkernel requiring a stringkernelEx object.

Value

An S4 kernel object of class stringkernelEx.

Note

All newline in the input strings are internally converted to carriage returns (\r).

Author(s)

Martin Kober
martin.kober@gmail.com

See Also

stringdot

Examples

s = "The cat was chased by the fat dog"
t = "The fat cat bit the dog"
stk = stringdotEx(type="spectrum", length=3, normalized=FALSE)
stk(s,t)
stk(s,s)


[Package stringkernels version 0.8.8 Index]