
Sorry, the statement below of the function I need is full of mistakes, this is the correct statement:
function pairwiseMahalanobis(X,Y,Q) distances = zeros(size(X,2),size(Y,2)) for i=1:size(X,2) for j=1:size(Y,2) distances[i,j] = sqrt(((X[:,i]  Y[:,j])'*inv(Q)*(X[:,i]  Y[:,j]))[1]) end end return distances end
julia> pairwiseMahalanobis(X,Y,eye(2)) 2x3 Array{Float64,2}: 0.0 2.82843 5.65685 2.82843 0.0 2.82843
Bradley
On Saturday, August 30, 2014 11:26:59 AM UTC5, Bradley Setzler wrote: In using Distances.jl, the following pairwise 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]  mean(X,2))*inv(Q)*(Y[:,j]mean(Y,2)) 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 "juliastats" 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.
