Hi Yarik:<br><br>I started to stick the mahalanobisDistance function in with the metrics, but then realized that this is not where mahalanobis would ever be used.&nbsp; Instead of using mahalanobis distance to calculate the neighborhood information for a voxel, it&#39;s actually more like a classifier.&nbsp; The other difference is that there are major optimizations I&#39;ve implemented for calculating the pairwise distances on a whole set of vectors, not just two at a time.&nbsp; 
<br><br>And I have no secrets for how I want to use it.&nbsp; I&#39;ve been thinking about a supervised mahalanobis distance kernel for classification along with Francois Meyer.&nbsp; 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.&nbsp; 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, ...&nbsp; 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.&nbsp; The working hypothesis is that the mahalanobis distance kernel will correct for skewed distributions along various dimensions in the data.&nbsp; In the case where there is no skew, it should just fall back to being standard cartesian distance.
<br><br>So, given all that, do you still think I should drop the mahalanobisDistance function into the metric.py code?&nbsp; I&#39;ll stick it in there for now so that you can see it.<br><br>Thanks,<br>Per<br><br><br><div class="gmail_quote">
On Dec 5, 2007 11:08 PM, Yaroslav Halchenko &lt;<a href="mailto:debian@onerussian.com">debian@onerussian.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">&gt; &nbsp; &nbsp;I just updated the PLF code to make use of the states. &nbsp;It&#39;s exactly<br>&gt; &nbsp; &nbsp;what I wanted in there, thanks!<br></div>That is great that you like it!<br><div class="Ih2E3d"><br>&gt; &nbsp; &nbsp;I&#39;d like to add in my mahalanobis distance function. &nbsp;Any suggestions
<br>&gt; &nbsp; &nbsp;as to where I put it? &nbsp;I was thinking either in mvpa.misc.stats or<br>&gt; &nbsp; &nbsp;mvpa.algorithms, but I&#39;m not sure where is best.<br></div>what do you use as the relation matrix for Mahalanobis distance (if that
<br>is not a secret spice ;-))?<br><br>at some moment we decided that all neighborhood information is provided<br>by a MetricMapper (and MaskMapper is such iirc).<br>For Mahalanobis distance I guess you would need to create a distance
<br>function and create a DescreteMetric which you would use to parametrize<br>MaskMapper constructor. See smth like<br>tests/test_mask{mapper,eddataset}.py I guess.<br>Actually I just adjusted MaskMapper to be a bit easier to accept your
<br>new distance: you can simply provide distance_function parameter to get<br>it to the right one. Please see/merge my branch on alioth to get it.<br><br>New distance function should belong to mvpa.datasets.metric I<br>guess. In case of Mahalanobis distance it must be &nbsp;a functor class I
<br>guess since it is parametrized with a matrix. But besides that it is<br>simple -- just another distance_function I guess.<br><br>The only issue I see now, but I don&#39;t want to jump on is that<br>NiftiDataset assumes cartesianDistance but we can either parametrize
<br>constructor there or let you simply override the mapper&#39;s metric (see in<br>NiftiDataset.__init__ for the example ;-)) later on<br><div class="Ih2E3d"><br>&gt; &nbsp; &nbsp;Eventually I&#39;d like to run searchlights that use the mahalanobis
<br>&gt; &nbsp; &nbsp;distance as the measure of choice.<br></div>Interesting example ;)<br>--<br>Yaroslav Halchenko<br>Research Assistant, Psychology Department, Rutgers-Newark<br>Student &nbsp;Ph.D. @ CS Dept. NJIT<br>Office: (973) 353-5440x263 | FWD: 82823 | Fax: (973) 353-1171
<br> &nbsp; &nbsp; &nbsp; &nbsp;101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07102<br>WWW: &nbsp; &nbsp; <a href="http://www.linkedin.com/in/yarik" target="_blank">http://www.linkedin.com/in/yarik</a><br><br>_______________________________________________
<br>Pkg-exppsy-maintainers mailing list<br><a href="mailto:Pkg-exppsy-maintainers@lists.alioth.debian.org">Pkg-exppsy-maintainers@lists.alioth.debian.org</a><br><a href="http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-maintainers" target="_blank">
http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-maintainers</a><br></blockquote></div><br>