powered by
Compute a pairwise distance measure between all rows of two numeric H2OFrames.
h2o.distance(x, y, measure)
An H2OFrame object (large, references).
An H2OFrame object (small, queries).
An optional string indicating what distance measure to use. Must be one of: "l1" - Absolute distance (L1-norm, >=0) "l2" - Euclidean distance (L2-norm, >=0) "cosine" - Cosine similarity (-1...1) "cosine_sq" - Squared Cosine similarity (0...1)
h2o.init() prosPath <- system.file("extdata", "prostate.csv", package="h2o") prostate.hex <- h2o.uploadFile(path = prosPath) h2o.distance(prostate.hex[11:30,], prostate.hex[1:10,], "cosine")
Run the code above in your browser using DataLab