[Pkg-exppsy-maintainers] States Rock! and Question

Per B. Sederberg persed at princeton.edu
Thu Dec 6 16:26:56 UTC 2007


On Dec 6, 2007 12:03 AM, Per B. Sederberg <persed at princeton.edu> wrote:

> Hi Yarik:
>
> I started to stick the mahalanobisDistance function in with the metrics,
> but then realized that this is not where mahalanobis would ever be used.
> Instead of using mahalanobis distance to calculate the neighborhood
> information for a voxel, it's actually more like a classifier.  The other
> difference is that there are major optimizations I've implemented for
> calculating the pairwise distances on a whole set of vectors, not just two
> at a time.
>
> And I have no secrets for how I want to use it.  I've been thinking about
> a supervised mahalanobis distance kernel for classification along with
> Francois Meyer.  The basic idea is that you would take into account the
> underlying distributions of the labeled samples when calculating the kernel
> distances at training and when determining the distances for the test
> points.  Then you can use these, supposedly better, kernels in place of any
> other kernel in any of the kernel methods such as SVM, kerneled ridger
> regression, ...  Given that you need to have more samples than features for
> mahalanobis to make much sense, I would like to run this within a
> searchlight.  The working hypothesis is that the mahalanobis distance kernel
> will correct for skewed distributions along various dimensions in the data.
> In the case where there is no skew, it should just fall back to being
> standard cartesian distance.
>

In addition to this use, I could see extending the KNN classifier to use
Mahalanobis distance instead of the Euclidean distance it currently uses.

Sooo, let me know if you have a better location for the mahalanobis distance
metric.  Otherwise, I'll just keep it where it is in datasets/metric.py and
add in some unit tests.  As it stands, it is not possible to use it as a
distance_function in those Masked Mappers because, just as you said, it
requires that you specify a covariance matrix to use.  In some cases, it
would be necessary to use a different covariance matrix depending on the
labels of the samples you are using.

Best,
Per




>
> So, given all that, do you still think I should drop the
> mahalanobisDistance function into the metric.py code?  I'll stick it in
> there for now so that you can see it.
>
> Thanks,
> Per
>
>
>
> On Dec 5, 2007 11:08 PM, Yaroslav Halchenko <debian at onerussian.com> wrote:
>
> > >    I just updated the PLF code to make use of the states.  It's
> > exactly
> > >    what I wanted in there, thanks!
> > That is great that you like it!
> >
> > >    I'd like to add in my mahalanobis distance function.  Any
> > suggestions
> > >    as to where I put it?  I was thinking either in mvpa.misc.stats or
> > >    mvpa.algorithms, but I'm not sure where is best.
> > what do you use as the relation matrix for Mahalanobis distance (if that
> >
> > is not a secret spice ;-))?
> >
> > at some moment we decided that all neighborhood information is provided
> > by a MetricMapper (and MaskMapper is such iirc).
> > For Mahalanobis distance I guess you would need to create a distance
> > function and create a DescreteMetric which you would use to parametrize
> > MaskMapper constructor. See smth like
> > tests/test_mask{mapper,eddataset}.py I guess.
> > Actually I just adjusted MaskMapper to be a bit easier to accept your
> > new distance: you can simply provide distance_function parameter to get
> > it to the right one. Please see/merge my branch on alioth to get it.
> >
> > New distance function should belong to mvpa.datasets.metric I
> > guess. In case of Mahalanobis distance it must be  a functor class I
> > guess since it is parametrized with a matrix. But besides that it is
> > simple -- just another distance_function I guess.
> >
> > The only issue I see now, but I don't want to jump on is that
> > NiftiDataset assumes cartesianDistance but we can either parametrize
> > constructor there or let you simply override the mapper's metric (see in
> > NiftiDataset.__init__ for the example ;-)) later on
> >
> > >    Eventually I'd like to run searchlights that use the mahalanobis
> > >    distance as the measure of choice.
> > Interesting example ;)
> > --
> > Yaroslav Halchenko
> > Research Assistant, Psychology Department, Rutgers-Newark
> > Student  Ph.D. @ CS Dept. NJIT
> > Office: (973) 353-5440x263 | FWD: 82823 | Fax: (973) 353-1171
> >        101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102
> > WWW:     http://www.linkedin.com/in/yarik
> >
> > _______________________________________________
> > Pkg-exppsy-maintainers mailing list
> > Pkg-exppsy-maintainers at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-maintainers
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/pkg-exppsy-maintainers/attachments/20071206/43127de1/attachment-0001.htm 


More information about the Pkg-exppsy-maintainers mailing list