Hi,

In any case you can just supply metric='chebyshev' to do that for you in
NearestNeighbors.

On Wed, Feb 10, 2016 at 10:10 PM, Shishir Pandey <shishir...@gmail.com>
wrote:

> Thanks.
>
> --
> sp
>
> On Thu, Feb 11, 2016 at 6:41 AM, Daniel Homola <
> daniel.homol...@imperial.ac.uk> wrote:
>
>> Hi,
>>
>> Mr Mayorov has done a great job and coded this up already:
>>
>> https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_selection/mutual_info_.py
>>
>> If you want to do feature selection based on MI, check out the JMI method:
>> https://github.com/danielhomola/mifs
>>
>> Cheers,
>> d
>>
>>
>> On 02/11/2016 01:07 AM, Shishir Pandey wrote:
>>
>> Hi
>>
>> I want to estimate the mutual information based on nearest neighbor
>> method:
>> http://arxiv.org/pdf/cond-mat/0305641.pdf
>>
>>
>> This requires me to use the max norm. For which I have defined a function
>> norm. Not I want Nearest neighbors to fit according to this norm and when I
>> find the kneighbors I want it to give me kneighbors based on this max norm
>> but instead I am getting results in Euclidean distances. How do I fix this?
>> Here is the class that I have created.
>>
>>
>> class MaxNormNN:
>>     """
>>     Nearest neighbors based on max norm
>>     """
>>
>>     def __init__(self, x_dim, y_dim, x, y):
>>         self.x_dim = x_dim
>>         self.y_dim = y_dim
>>         self.x = x
>>         self.y = y
>>         self. z = np.c_[x,y]
>>
>>
>>     def max_norm(self, z1, z2, ord = 1):
>>         x_dist = np.linalg.norm(np.array(z1[:self.x_dim]) - \
>>         np.array(z2[:self.x_dim]), ord = ord)
>>         y_dist = np.linalg.norm(np.array(z1[self.x_dim:]) - \
>>         np.array(z2[self.x_dim:]), ord = ord)
>>         return np.max([x_dist, y_dist])
>>
>>     def NNs(self):
>>         nn = NearestNeighbors(n_neighbors = 2, func = max_norm)
>>         nn.fit(self.z)
>> #        print nn.kneighbors(self.z)
>>
>>
>>
>> --
>> sp
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup 
>> Now!http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>>
>>
>>
>> _______________________________________________
>> Scikit-learn-general mailing 
>> listScikit-learn-general@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> _______________________________________________
>> Scikit-learn-general mailing list
>> Scikit-learn-general@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>


-- 
Manoj,
http://github.com/MechCoder
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to