stringdotEx {stringkernels} | R Documentation |
Character-based string kernels, analogous to kernlab's stringdot
.
stringdotEx(type = c("spectrum", "boundrange", "constant", "exponential"), length = 4, lambda = 1.1, normalized = TRUE)
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 )
|
This function is identical to the stringdot
function in kernlab,
but compatible with functions like precomputedkernel
requiring a stringkernelEx
object.
An S4 kernel object of class stringkernelEx
.
All newline in the input strings are internally converted to carriage returns
(\r
).
Martin Kober
martin.kober@gmail.com
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)