Hi there,

I'd like to generate hyperplanes in a high dimensional space, but don't know how to achieve this.

For example, I've got a matrix "M" with 10 row vectors of 32 dimensions, I'd like to generate a matrix of 3 hyperplanes and check for each vectors in "M" on which side of each hyperplane it lies.

Is that possible ?

Thanks for your help :)

asked Sep 13 '11 at 11:05

Jay's gravatar image

Jay
1222

I ommit to say random hyperplanes ..

(Sep 13 '11 at 11:06) Jay

2 Answers:

Just generate 3 random vectors of dimension 32 and then compute dot products and check the signs:

In [1]: import numpy as np

In [2]: M = np.random.normal(size=(10, 32))

In [3]: hyperplanes = np.random.normal(size=(3, 32))

In [4]: np.sign(np.dot(M, hyperplanes.T))
Out[4]:
array([[-1.,  1.,  1.],
       [-1.,  1.,  1.],
       [-1.,  1.,  1.],
       [ 1.,  1., -1.],
       [ 1.,  1., -1.],
       [-1.,  1., -1.],
       [-1.,  1.,  1.],
       [-1.,  1., -1.],
       [-1., -1.,  1.],
       [-1.,  1., -1.]])

answered Sep 13 '11 at 12:41

ogrisel's gravatar image

ogrisel
398464480

Thanks :) Naïve question : hyperplanes aren't n-1 dimensional ?

If I'd like to quantize vectors of 2 distinct matrix with hyperplanes, should I use the same radom hyperplanes for each matrix or generate 2 random hyperplanes matrix ?

(i'm kind of a newbee in this field)

Regards

(Sep 14 '11 at 03:19) Jay
1

Yes they are but each of them is fully parameterized by an orthogonal vector of dimension n called the normal vector. Those normal vectors are stored in the hyperplane variable above.

About your second question, it all depends on what you are trying to achieve. If you are trying to implement some sort of LSH using random projections as hashing functions then yes you should always reuse the same hashing functions on the new data you want ot hash if you want to compare it with previously hashed data.

(Sep 14 '11 at 04:00) ogrisel

Excellent, that helps me a lot :) thx again

(Sep 14 '11 at 08:22) Jay

Thanks :) Naïve question : hyperplanes aren't n-1 dimensional ?

If I'd like to quantize vectors of 2 distinct matrix with hyperplanes, should I use the same radom hyperplanes for each matrix or generate 2 random hyperplanes matrix ?

(i'm kind of a newbee in this field)

Regards

answered Sep 14 '11 at 03:19

Jay's gravatar image

Jay
1222

Your answer
toggle preview

powered by OSQA

User submitted content is under Creative Commons: Attribution - Share Alike; Other things copyright (C) 2010, MetaOptimize LLC.