I would like to use NearestNeighbors.jl to find the nearest string in Hamming distance from a given input string. Do I have to convert them to floats to use the NearestNeighbors library? I would prefer to avoid this because of precision issues and memory use. For example, I can't use ints with BallTree:
data = rand(1:4, (10, 10^4))
balltree = BallTree(data, Hamming())
gives the following error:
LoadError: MethodError: `convert` has no method matching convert(::Type{NearestNeighbors.BallTree{T<:AbstractFloat,M<:Distances.Metric}}, ::Array{Int64,2}, ::Distances.Hamming)
This may have arisen from a call to the constructor NearestNeighbors.BallTree{T<:AbstractFloat,M<:Distances.Metric}(...),
since type constructors fall back to convert methods.
Closest candidates are:
NearestNeighbors.BallTree{T<:AbstractFloat,M<:Distances.Metric}(!Matched::Array{T<:AbstractFloat,2}, ::M<:Distances.Metric)
call{T}(::Type{T}, ::Any)
convert{T}(::Type{T}, !Matched::T)
...
while loading In[53], in expression starting on line 2
in call at essentials.jl:57
Is there a specific reason that AbstractFloat is the parent type? Distances.jl can handle other types just fine:
evaluate(Hamming(), ["A","B","C"], ["A","B","D"])
I'm using Julia v0.4.1 and the masters of both NearestNeighbors and Distances
I would like to use
NearestNeighbors.jl
to find the nearest string in Hamming distance from a given input string. Do I have to convert them to floats to use the NearestNeighbors library? I would prefer to avoid this because of precision issues and memory use. For example, I can't use ints with BallTree:gives the following error:
Is there a specific reason that
AbstractFloat
is the parent type?Distances.jl
can handle other types just fine:I'm using Julia v0.4.1 and the masters of both NearestNeighbors and Distances