Permalink
Browse files

Put -create and -histogram into different options.

  • Loading branch information...
1 parent 8ee308d commit e7fadce60ca218b25de789fff73ca0d92c1a4b43 @MalcolmSlaney MalcolmSlaney committed Oct 17, 2011
Showing with 9 additions and 5 deletions.
  1. +6 −3 doc/examples.html
  2. +3 −2 lsh.py
View
@@ -75,8 +75,11 @@
Now we can create the distance histograms.
<PythonCode> python2.6 lsh.py -d 5 -histogram
</PythonCode>
-This Matlab code reads in the newly created distance data.
-<MatlabCode>load testData005.distances
+This Matlab code reads in the newly created distance data and computes the distance histograms.
+<MatlabCode>testData = load('testData005.distances');
+nBins = 40;
+[dnnHist, dnnBins] = hist(testData(:,1), nBins);
+[danyHist, danyBins] = hist(testData(:,2), nBins);
</MatlabCode>
Given this distance data,
we can calculate the optimal LSH statistics. Do this for
@@ -108,7 +111,7 @@
Exact L: 3 6 14
Exact Cost: 2.96372 5.94376 11.9977
</MatlabResults>
-A number of debugging plots are create if you set the "debugPlot"
+A number of debugging plots are created if you set the "debugPlot"
variable at the top of the CalculateMPLSHParameters() function.
These results are shown here.
View
5 lsh.py
@@ -1047,10 +1047,11 @@ def OutputAllProjections(myTestData, myTestIndex, filename):
except:
print "Couldn't parse new value for multiprobeRadius: %s" % arg
print 'New default multiprobeRadius for test is', defaultMultiprobeRadius
- elif arg == '-create': # Create some uniform random data
+ elif arg == '-create': # Create some uniform random data and find NN
myTestData = RandomTestData()
myTestData.CreateData(100000, defaultDims)
myTestData.SaveData(defaultFileName + '.dat')
+ print "Finished creating random data. Now computing nearest neighbors..."
myTestData.FindNearestNeighbors(defaultClosest)
myTestData.SaveNearestNeighbors(defaultFileName + '.nn')
elif arg == '-histogram': # Calculate distance histograms
@@ -1100,7 +1101,7 @@ def OutputAllProjections(myTestData, myTestIndex, filename):
# ComputePnnPanyCurve(myData, [.291032])
lList = [math.floor(math.sqrt(2)**k) for k in range(0,10)]
lList = [1,2,3,4,5,6,8,10,12,14,16,18,20,22,25,30]
- myTestData.ComputeLCurve(lList, w=defaultW, k=10)
+ myTestData.ComputeLCurve(lList, w=defaultW, k=defaultK)
elif arg == '-timing':
# sys.argv.pop(0)
timingModels = []

0 comments on commit e7fadce

Please sign in to comment.