In using Distances.jl, the following pair-wise Euclidean distance is successful: julia> X 2x2 Array{Float64,2}: 1.0 3.0 2.0 4.0 julia> Y 2x3 Array{Float64,2}: 1.0 3.0 5.0 2.0 4.0 6.0 julia> pairwise(Euclidean(), X, Y) 2x3 Array{Float64,2}: 0.0 2.82843 5.65685 2.82843 0.0 2.82843 What is the corresponding code to compute the Mahalanobis distances between the columns of X and Y, sqrt of, (X[:,i] - Y[:,j])'*inv(Q)*(X[:,i] - Y[:,j]) for each (i,j). where Q would ideally default to, say, identity (the case of Mahalanobis => Euclidean). I thought this might do it: julia> pairwise(Mahalanobis(), X, Y,eye(2)) `Mahalanobis{T}` has no method matching Mahalanobis{T}() Thanks, Bradley You received this message because you are subscribed to the Google Groups "julia-stats" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
The identity matrix you're trying to pass I think as Q as the final argument to pairwise needs to be passed to the Mahalanobis constructor. Read this as "take pairwise distances using the Mahalanobis (with Q=eye(2)) metric between X and Y":
-- pairwise(Mahalanobis(eye(2)), X, Y) On Saturday, August 30, 2014 12:20:20 PM UTC-5, Bradley Setzler wrote:
You received this message because you are subscribed to the Google Groups "julia-stats" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Thank you Patrick, that works.
-- Bradley On Tuesday, September 2, 2014 5:10:44 PM UTC-5, Patrick O'Leary wrote:
You received this message because you are subscribed to the Google Groups "julia-stats" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
You're welcome!
-- On Tuesday, September 2, 2014 8:40:48 PM UTC-5, Bradley Setzler wrote:
You received this message because you are subscribed to the Google Groups "julia-stats" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |