This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// export data to csv | |
print("ap_mac,tags"); | |
db.managedaps.find({}).forEach(function(ap){ | |
print(ap.mac+","+ap.tags); | |
}); | |
// mongo dbname filename.js > out.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
hist, bin_edges = np.histogram([1, 1, 2, 2, 2, 2, 3], bins = range(5)) | |
plt.bar(bin_edges[:-1], hist, width = 1) | |
plt.xlim(min(bin_edges), max(bin_edges)) | |
plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def numBins(metric, defaultBins): | |
h = binWidth(metric) | |
ulim = max(metric) | |
llim = min(metric) | |
if (h <= (ulim - llim) / len(metric)): | |
return defaultBins or 10 | |
return int(math.ceil((ulim - llim) / h)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// metric = array of real numbers (like > 100 or something) | |
// IQR = inter-quaartile-range | |
function numBins(metric, defaultBins) { | |
var h = binWidth(metric), ulim = Math.max.apply(Math, metric), llim = Math.min.apply(Math, metric); | |
if (h <= (ulim - llim) / metric.length) { | |
return defaultBins || 10; // Fix num bins if binWidth yields too small a value. | |
} | |
return Math.ceil((ulim - llim) / h); | |
} |
NewerOlder