Hi! I was trying to change the weights of a BallTreeDensity when I encountered this error.
Here's the relevant source code:
getIndexOf(bd::BallTreeDensity, i::Int) = getIndexOf(bd.bt, i)
function changeWeights!(bd::BallTreeDensity, newWeights::Array{Float64,1})
for i in (bd.bt.num_points+1):bd.bt.num_points*2
bd.bt.weights[i] = newWeights[ getIndexOf(bt, i) ]; # <--- error here
end
for i in bd.bt.num_points:-1:1
calcStats!(bd.bt.data,i)
end
calcStats!(bd.bt.data, root());
return nothing
end
It seems like maybe the getIndexOf(bt, i) call should instead be getIndexOf(bd, i)?
This might be a separate issue. I'm working with trivariate data. Could that be why? Should there be an addop/diffop for each dimension?
EDIT 2:
It looks like this works, maybe?
function changeWeights!(bd::BallTreeDensity, newWeights::Array{Float64,1})
for i in (bd.bt.num_points+1):bd.bt.num_points*2
bd.bt.weights[i] = newWeights[ getIndexOf(bd, i) ];
end
addop = Tuple(fill(+, bd.bt.dims))
diffop = Tuple(fill(-, bd.bt.dims))
for i in bd.bt.num_points:-1:1
calcStats!(bd.bt.data, i, addop, diffop)
end
calcStats!(bd.bt.data, root(), addop, diffop);
return nothing
end
Hi, thanks for opening an issue. It looks like some functions might not be fully upgraded to use addop and doffp yet.
@dehann will be the best person to help you on this one.
Hi! I was trying to change the weights of a BallTreeDensity when I encountered this error.
Here's the relevant source code:
It seems like maybe the
getIndexOf(bt, i)
call should instead begetIndexOf(bd, i)
?EDIT: I tried fixing it but got this:
This might be a separate issue. I'm working with trivariate data. Could that be why? Should there be an addop/diffop for each dimension?
EDIT 2: It looks like this works, maybe?