Hi all,

tldr: Is there a way for me to pass a 3D array to KNearestNeighbour?

I have constructed a custom distance metric to be used with KNN. It takes *two
2D arrays* and returns a float. I believe this fits the requirements for a
distance metric in sklearn.

However, I am unable to pass a 3D array to KNearestNeighbour. I get the
following error:

/Library/Python/2.7/site-packages/sklearn/neighbors/base.pyc in
_fit(self, X)    178     179         if X.ndim != 2:--> 180
 raise ValueError("data type not understood")    181     182
n_samples = X.shape[0]
ValueError: data type not understood


Is there a way for me to pass a non 2D array to KNearestNeighbour? For
context, I'm implementing a 1NN with Dynamic Time Warping.

If not, is there a work around or a suggestion?

Many thanks
Mark
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to