Skip to content

Instantly share code, notes, and snippets.

@dvreed77
dvreed77 / index.html
Created October 13, 2013 16:45
Simple particles in box example!
<!DOCTYPE html>
<meta charset="utf-8">
<style>
</style>
<body>
</body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var w = 500,
h = 500,
@dvreed77
dvreed77 / backup (1).json
Last active December 23, 2015 15:59
Draw lines
[[{"x":154,"y":83},{"x":156,"y":84},{"x":157,"y":84},{"x":159,"y":84},{"x":163,"y":88},{"x":172,"y":93},{"x":179,"y":98},{"x":184,"y":101},{"x":193,"y":109},{"x":199,"y":114},{"x":202,"y":118},{"x":204,"y":122},{"x":205,"y":132},{"x":207,"y":147},{"x":210,"y":166},{"x":213,"y":182},{"x":219,"y":198},{"x":232,"y":214},{"x":245,"y":233},{"x":256,"y":245},{"x":265,"y":251},{"x":269,"y":254}],[{"x":328,"y":176},{"x":330,"y":176},{"x":334,"y":180},{"x":340,"y":187},{"x":351,"y":195},{"x":359,"y":207},{"x":363,"y":211},{"x":366,"y":213},{"x":368,"y":218},{"x":371,"y":229},{"x":376,"y":247},{"x":381,"y":259},{"x":387,"y":268},{"x":393,"y":274},{"x":402,"y":280},{"x":410,"y":284},{"x":419,"y":288},{"x":425,"y":291},{"x":433,"y":293}]]
@dvreed77
dvreed77 / grc.json
Created May 11, 2013 16:01
Trying to make a map of Greece!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dvreed77
dvreed77 / classify_test.m
Last active December 13, 2015 22:18
The effect of using uniform priors with unbalanced classes.
N1 = 3500; N2 = 1500;
data = [randn(N1, 1) ; 1 + randn(N2, 1)];
labels = [zeros(N1, 1) ; ones(N2, 1)];
for ii = 1:200
cv(ii) = cvpartition(labels, 'Holdout', 0.2);
end
b_pcc = zeros(1, cv.NumTestSets);
for ii = 1:length(cv)
@dvreed77
dvreed77 / class_compare.m
Created February 18, 2013 20:30
Difference between Matlab's classify and ClassificationDiscriminant functions.
%% Balanced Classes, easily seperable
data = [randn(2500, 1) ; 1 + randn(2500, 1)];
labels = [zeros(2500, 1) ; ones(2500, 1)];
y_pred = classify(data, data, labels);
TP1 = sum(y_pred == 1 & labels == 1);
temp = ClassificationDiscriminant.fit(data, labels);
y_pred2 = temp.predict(data);
TP2 = sum(y_pred2 == 1 & labels == 1);