Hi,
You cannot use complex numbers, they should be real numbers. Each data
point should be in |R^d (where d is the dimensionality).


2014-09-17 19:45 GMT+02:00 Neal Becker <ndbeck...@gmail.com>:

> I just tried k-nearest neighbors where the data are complex.  It doesn't
> seem to
> work correctly.
>
> I tried
>
> import numpy as np
> from const64apsk import gen_constellation_64apsk
>
> const = gen_constellation_64apsk ('3/4')
> X = [[e] for e in const]
> y = np.arange(64)
>
> from sklearn.neighbors import KNeighborsClassifier
> neigh = KNeighborsClassifier(n_neighbors=3)
> neigh.fit(X, y) # doctest: +ELLIPSIS
> print(neigh.kneighbors([const[0]]))
>
> Don't worry about the module const64apsk, all that matters here are that
> const is a 1-d array of 64 complex values.
>
> I'm guessing KNeighborsClassifier doesn't understand complex arithmetic,
> and I'd
> need to give the points as 2-d real,imag values?
>
> --
> -- Those who don't understand recursion are doomed to repeat it
>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>



-- 
Mohamed-Rafik BOUGUELIA
PhD Student
INRIA Nancy Grand Est - LORIA - READ Team
Nancy University - France.
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&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