In [9]:
import json
import numpy as np
import os, sys
sys.path.append('../classification')
import classify_nested
from sklearn.feature_selection import f_classif
from sklearn.feature_selection import SelectKBest

In [8]:
X = np.random.randn(40).reshape(10,4)
y = np.array([np.random.random_integers(2)-1 for i in range(10)])
print(X)
print(y)

print(classify_nested.customScore(X,y))
print(f_classif(X,y))


[0 0 0 1 0 1 1 0 1 0]
[ 40.          38.04917698  36.19349672  34.42831906]
(array([ 40.        ,  38.04917698,  36.19349672,  34.42831906]), array([ 0.01,  0.01,  0.01,  0.01]))
(array([ 0.82848058,  1.17991447,  0.26375954,  1.63295256]), array([ 0.38931253,  0.30901636,  0.62142871,  0.23712545]))
/usr/lib/python3.6/site-packages/ipykernel/__main__.py:2: DeprecationWarning: This function is deprecated. Please call randint(1, 2 + 1) instead
  from ipykernel import kernelapp as app

In [ ]:
selector = SelectKBest(k=2)
selector.fit