Skip to content

Instantly share code, notes, and snippets.

@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);
@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 / grc.json
Created May 11, 2013 16:01
Trying to make a map of Greece!
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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 / index.html
Last active December 26, 2015 11:49
Register mouse events on screen
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.overlay {
fill-opacity: 0.1;
}
circle {
fill: black;
}
</style>
@dvreed77
dvreed77 / es.sh
Created October 16, 2015 20:52 — forked from rajraj/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@dvreed77
dvreed77 / gist:b4bd63a15acac2dd4a19
Created November 20, 2015 21:39 — forked from ChadFulton/gist:7535278
Statsmodels ARIMA Example
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from selenium import webdriver
# driver = webdriver.Firefox()
driver = webdriver.PhantomJS()
driver.set_window_size(1120, 550)
driver.get("https://duckduckgo.com/")
driver.find_element_by_id('search_form_input_homepage').send_keys("google slavery")
driver.find_element_by_id("search_button_homepage").click()
out = driver.find_elements_by_xpath("//div[@id='links']/div")
# out
@dvreed77
dvreed77 / index.html
Created August 1, 2016 18:59
Copy an image to clipboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p>
<textarea class="js-copytextarea">Hello I'm some text</textarea>