The X array which I'm using to fit for the kNN algorithm is n_samples  x n
features big.

but for calculating the distance or in this case the tanimoto.

i thought  tanimot(x,y)  if I call it with :
KNeighborsClassifier(metric=tanimoto).fit(X_train,y_train) is,

x= is in sample and y= is one sample. So x is somehow converted into this
skalar array.

If I'm printing out your example, it actually works:
[ 0.35592602  0.75653009  0.53405987  0.47403539  0.56255335  0.82097978
  0.90163467  0.67498667  0.09987697  0.0341568 ] [ 0.35592602  0.75653009
0.53405987  0.47403539  0.56255335  0.82097978
  0.90163467  0.67498667  0.09987697  0.0341568 ]

print
x               y
[ 0.  0.] [-1. -1.]
[ 0.  0.] [-2. -1.]
[ 0.  0.] [-3. -2.]
[ 0.  0.] [ 1.  1.]
[ 0.  0.] [ 2.  1.]
[ 0.  0.] [ 3.  2.]
[-1. -1.] [ 0.  0.]
[-1. -1.] [-1. -1.]
......
......

But there are still at the first 2 lines the skalars.


the output from my X_train is:



[array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,
......
        1.,  0.,  0.,  1.,  1.,  1.,  1.,  0.,  1.,  0.,  1.,  0.,  1.,
        0.,  1.,  0.,  1.,  1.,  1.,  0.,  1.,  0.,  0.,  1.,  0.,  1.,
        1.,  0.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  0.]), array([
0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
......
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,  1.,  1.,  0.,  0.,
        1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,
        1.,  1.,  0.,  1.,  0.,  1.,  1.,  1.,  0.,  1.,  0.,  0.,  0.,
        0.,  1.,  0.,  1.,  1.,  0.,  1.,  1.,  1.,  1.,  0.]), array([
0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  0.,
        0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
...
        0.,  0.,  0.,  1.,  1.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,
        0.,  1.,  0.,  0.,  0.,  1.,  1.,  1.,  1.,  0.,  0.,  1.,  0.,
        1.,  0.,  1.,  0.,  1.,  1.,  1.,  1.,  1.,  1.,  0.]), array([
0.,  0.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,....
------------------------------------------------------------------------------
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=267308311&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