I'm using neupy to get a set of neurons with following code:
All = pd.read_csv("inputfile.csv")
df = pd.DataFrame(All)
coords = df.as_matrix(columns=['lat', 'lng'])
sofmnet = algorithms.SOFM(n_inputs=2,
n_outputs=4,
step=0.5,
show_epoch=1,
shuffle_data=True,
verbose=True,
learning_radius=1,
features_grid=(4, 1),)
sofmnet.train(coords,epochs=20)
neuronlocations = sofmnet.weight.T
1-How to read/get the set of points associated with each neuron? 2-The inputfile.csv has date,lat,lng fields. I want to count the number of points for each neuron for every day. how to proceed? thanks
You can use the
predict
method in order to find encoding of the closest neuron. Here is an example from the official documentation.Prediction returns one-hot encoded neuron identifiers. You can get neuron's index by applying argmax over the output
You can use this information in order to solve second problem as well.