In [1]:
%matplotlib inline
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn import preprocessing
import matplotlib.pyplot as plt
In [2]:
lrgs = np.loadtxt('../data/CFHTLS_LRGs.txt')
features = lrgs[:,2:]
positions = lrgs[:,:2]
scaler = preprocessing.StandardScaler().fit(features)
scaled_features = scaler.transform(features)
test_gal = np.array([.6,25,24,23,22,21])
scaled_test = scaler.transform(test_gal)
In [55]:
nbrFinder = NearestNeighbors(n_neighbors=1,algorithm='auto',metric='euclidean').fit(scaled_features)
In [56]:
dists, inds = nbrFinder.kneighbors(scaled_test)
In [57]:
print dists, inds
In [59]:
positions[4247,:]
Out[59]:
In [61]:
type(scaler)
Out[61]:
In [ ]: