Note that you could just say that I should stay away from using BallTree
and use NearestNeighbor instead. In particular I could use the method
NearestNeighbor.radius_neighbors instead of BallTree.query_radius.
However, the output of NearestNeighbor.radius_neighbors is of the same
problematic type as BallTree.query_radius
On Wed, Nov 21, 2012 at 1:22 PM, Conrad Lee <[email protected]> wrote:
> I'm having a hard time when using BallTree.query_radius.
>
> Consider the following example:
>
> points = np.random.random((10,3))
> bt = BallTree(X)
> idxs = bt.query_radius((0.0,0.0,0.0), r=1)
>
> The strange thing is that idxs is of dtype "object". I thus can't use it
> in the way I'd normally use it if it were an integer array. I can't do
> idxs.ravel() to get a flat list of the indices. idxs.shape returns (1,),
> which is awkward. If I run `idxs.astype("u8") I get an error (ValueError:
> setting an array element with a sequence.).
>
> It's especially awkward because this is all different from the index array
> I get when I run BallTree.query(...).
>
> Is this behavior intended? Can it be improved? How can I convert the
> array of dtype "object" into an integer array?
>
>
>
------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general