hi ariel,

on the unit sphere, the dot product of the vectors would be exactly that
except for the range. you would want to scale it so that -1 to 1 maps to 0
to 1 and then run spectral clustering on that matrix. if you have too many
vectors you can create a sparse matrix, but on my mbp i can handle a dense
10000 x 10000 in about a few minutes.

dummy example:

In [1]: import numpy as np
In [2]: from sklearn.cluster import SpectralClustering
In [4]: foo = np.random.rand(10000, 10000)
In [7]: sc = SpectralClustering(n_clusters=2, affinity='precomputed',
assign_labels='discretize').fit(foo)

cheers,

satra

On Thu, Jan 24, 2013 at 5:07 PM, Ariel Rokem <aro...@gmail.com> wrote:

> Hi Satra,
>
> Thanks for the hint. "Affinity", as in an affine transformation? Isn't the
> angle between any two unit vectors that transformation?
>
> Cheers,
>
> Ariel
>
>
>
> On Thu, Jan 24, 2013 at 1:01 PM, Satrajit Ghosh <sa...@mit.edu> wrote:
>
>> hi ariel,
>>
>> if you can precompute affinity between your vectors, you could also try
>> spectral clustering.
>>
>> cheers,
>>
>> satra
>>
>> On Thu, Jan 24, 2013 at 1:18 PM, Ariel Rokem <aro...@gmail.com> wrote:
>>
>>> Thanks everyone for chiming in!
>>>
>>> For now, I think that I will take Alex's heuristic (?) solution (also
>>> described here:
>>> http://www.sci.utah.edu/~weiliu/research/clustering_fmri/Zhong_sphericalKmeans.pdf).
>>> I also like CP's  projection idea - might work for my kind of data, which
>>> has antipodal symmetry. I will play with this a bit and report back on how
>>> well that's working for me.
>>>
>>> Thanks again,
>>>
>>> Ariel
>>>
>>>
>>> On Thu, Jan 24, 2013 at 5:35 AM, Bertrand Thirion <
>>> bertrand.thir...@inria.fr> wrote:
>>>
>>>> As alluded previously, you need to find a way to compute the centroid
>>>> by minimizing the sum of squared distances to a given set of points within
>>>> each cluster.  However, it is true that re-projecting the euclidean mean to
>>>> the sphere would approximate well the theoretical solution in most cases.
>>>>
>>>> A standard alternative to k-means is Von Mises-Fisher distribution.
>>>>
>>>> Bertrand
>>>>
>>>> ------------------------------
>>>>
>>>> *De: *"Vince Fernando" <y...@vincefernando.co.uk>
>>>> *À: *math...@mblondel.org, scikit-learn-general@lists.sourceforge.net
>>>> *Envoyé: *Jeudi 24 Janvier 2013 09:55:46
>>>> *Objet: *Re: [Scikit-learn-general] K means on a sphere
>>>>
>>>>
>>>> Are there any theoretical problems if one uses the great circle
>>>> (orthodromic) distance on a sphere in k-means or any other clustering
>>>> algorithm?
>>>> vince
>>>>
>>>>
>>>> On 24 January 2013 07:11, Mathieu Blondel <math...@mblondel.org> wrote:
>>>>
>>>>> On Thu, Jan 24, 2013 at 9:24 AM, Gael Varoquaux
>>>>> <gael.varoqu...@normalesup.org> wrote:
>>>>>
>>>>> > Yes, there is a massive difference in amount of work and performance
>>>>> when
>>>>> > you try to replace the Euclidean distance. Amongst other problems,
>>>>> the
>>>>> > mean is no longer the sum divided by the number of points, but the
>>>>> > Frechet mean, which requires solving an optimization problem.
>>>>>
>>>>> Indeed, if you replace the Euclidean distance, you also need to change
>>>>> the averaging.
>>>>> If you use the Manhattan distance, the averaging becomes the median.
>>>>>
>>>>> Mathieu
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>>>> MVPs and experts. ON SALE this month only -- learn more at:
>>>>> http://p.sf.net/sfu/learnnow-d2d
>>>>> _______________________________________________
>>>>> Scikit-learn-general mailing list
>>>>> Scikit-learn-general@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>>> MVPs and experts. ON SALE this month only -- learn more at:
>>>> http://p.sf.net/sfu/learnnow-d2d
>>>> _______________________________________________
>>>> Scikit-learn-general mailing list
>>>> Scikit-learn-general@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>>> MVPs and experts. ON SALE this month only -- learn more at:
>>>> http://p.sf.net/sfu/learnnow-d2d
>>>> _______________________________________________
>>>> Scikit-learn-general mailing list
>>>> Scikit-learn-general@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>>> MVPs and experts. ON SALE this month only -- learn more at:
>>> http://p.sf.net/sfu/learnnow-d2d
>>> _______________________________________________
>>> Scikit-learn-general mailing list
>>> Scikit-learn-general@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
>> MVPs and experts. ON SALE this month only -- learn more at:
>> http://p.sf.net/sfu/learnnow-d2d
>> _______________________________________________
>> Scikit-learn-general mailing list
>> Scikit-learn-general@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to