Skip to content

Instantly share code, notes, and snippets.

@jamie23
jamie23 / gist:2279462
Created April 1, 2012 23:32
Console output
javaw [-options] class [args...]
(to execute a class)
or javaw [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
function getImages()
%Puts images into matrices
% randomise weights
% Until total error < (0.1?) or you can do it until the validation set has a low error
% repeat for each letter
% apply first letter
% calculate error and make positive
% add first letter to total error
% change weight
%repeat
import java.util.Scanner;
public class Solution {
public static void main(String[] args){
Solution x = new Solution();
int[] A = {-7,1,5,2,-4,3,0};
System.out.println(x.solution(A));
}
@jamie23
jamie23 / gist:11197652
Created April 22, 2014 23:15
Good resources for papers
acm
siteseerx
research gate
@jamie23
jamie23 / Classification tree
Last active August 29, 2015 14:00
Creating regression tree on data
check = as.factor(groups)
#fit tree model with training data
tree_model = tree(check~., training_data)
plot(tree_model)
text(tree_model, pretty=0)
#model precision check
tree_pred = predict(tree_model, testing_data, type="class")
Removed comments for dissertation.
dataSmall <- read.delim("//Users//jamie//Programming//R//Dissertation//SmallData.out", row.names = 1)
dataBig <- read.delim("//Users//jamie//Programming//R//Dissertation//LargeData.tab", row.names = 1)
dataComplete <- merge(dataSmall,dataBig,by="row.names")
dataComplete[1]<-NULL
d = dist(cl, method = "euclidean")
fit = hclust(d, method = "ward")
plot(fit, labels=rownames(d), xaxt = "n")
groups = cutree(fit, k=3)
x = rect.hclust(fit, k=3, border="red", cluster = groups)
@jamie23
jamie23 / gist:a3495349ff5103a9b59b
Created May 5, 2014 01:17
3 cluster, hierarchical clustering, cluster.stats() output
$n
[1] 573
$cluster.number
[1] 3
$cluster.size
[1] 112 310 151
$min.cluster.size
https://www.youtube.com/watch?v=byeqpfBUyaU
@jamie23
jamie23 / gist:bbf56059883e195e76c4
Created February 2, 2015 17:08
Amazebots py code
# Pi2Go Motor Test
# Moves: Forward, Reverse, turn Right, turn Left, Stop - then repeat
# Press Ctrl-C to stop
#
# Also demonstrates writing to the LEDs
#
# To check wiring is correct ensure the order of movement as above is correct
# Run using: sudo python motorTest.py
import pi2go, time