Commits

dan mackinlay committed 7359ea3

oops - sampling wrong axis

  • Participants
  • Parent commits d81259e

Comments (0)

Files changed (1)

     ests = np.zeros(n_pairs)
     for i in xrange(n_pairs):
         #this is not sliced efficiently. Should restack. Anyway...
-        pair = stacked_vels[sample(xrange(n_agents), 2), :]
+        pair_indices = sample(xrange(n_agents), 2)
+        pair = stacked_vels[:, pair_indices].T
         ests[i] = ince_mi_dist_cont(pair[0], pair[1])   
     return ests
 
     about, from continuous input.
     
     If no n_bins is given, we choose the maximimum statistically valid number
-    by the cochrane criterion, and leave it be. This will give good results in
-    all except particularly pathological cases. (bins will be (marginwise)
-    approximately equal occupancy)
+    by the Cochrane criterion, and leave it be. This will give good results in
+    all except particularly pathological cases: Bins will be (marginwise)
+    approximately equal occupancy.
     """
     # kwargs.setdefault('method', 'qe')
     # kwargs.setdefault('sampling', 'kt')
     Y = np.asanyarray(Y).ravel()
     if n_bins is None:
         n_bins = choose_n_bins(X.size)
-    X, _ = pyentropy.quantise(X, n_bins, centers=False)
-    Y, _ = pyentropy.quantise(Y, n_bins, centers=False)
-    del(_) #Go away, extraneous data!
+    X, X_bins = pyentropy.quantise(X, n_bins, centers=False)
+    Y, Y_bins = pyentropy.quantise(Y, n_bins, centers=False)
     ds = pyentropy.DiscreteSystem(
       X, (1, n_bins),
       Y, (1, n_bins)
     )
     ds.calculate_entropies(**kwargs)
-    return ds.I()
+    I = ds.I()
+    return I
 
 def choose_n_bins(n_samples, test=True):
     """according to Cellucci et al (2005), the maximal number of bins is given