Skip to content

Instantly share code, notes, and snippets.

View Nectarineimp's full-sized avatar

Peter Mancini Nectarineimp

  • Steath Startup
  • Nashville, TN
View GitHub Profile
@Nectarineimp
Nectarineimp / 2048ml.clj
Created April 21, 2014 20:16
2048 Machine Learning Mucking About
;; 2048 machine learning analysis
;; Order, Free Space, Weight Distribution
;; Scoring Analysis, Nabla ∇ Divergence
;; initial board state - choose wisest direction for move (up down left right)
;; 2 0 2 4 0 pairs (actually a scoring pair is in there once the space is crossed.)
;; 2 2 4 0 1 pair
;; 4 4 0 0 1 scoring pair, 1 blank pair
;; 4 0 8 0 1 blank pair
@Nectarineimp
Nectarineimp / trig.clj
Created April 16, 2013 22:02
experiments in trigonometry in Clojure
(defn get-slope [[x1 y1] [x2 y2]]
(/ (- x2 x1) (- y2 y1)))
(get-slope [500 400][290 600])
(defn angle-offset [slope]
(java.lang.Math/atan slope))
(angle-offset (get-slope [500 400][300 490]))
@Nectarineimp
Nectarineimp / main.java
Created November 15, 2012 18:38
exploring coreferences from Stanford CoreNLP
Map<Integer, CorefChain> graph = document.get(CorefChainAnnotation.class);
for (Map.Entry<Integer, CorefChain> entry : graph.entrySet()) {
CorefChain c = entry.getValue();
System.out.println("\nClusterID: " + entry.getKey());
CorefMention cm = c.getRepresentativeMention();
if (cm != null) {
System.out.println("Representative Mention: " + cm.mentionSpan + " @" + cm.position.elems()[0] + " H:" + cm.position.elems()[1] + " [ " + cm.startIndex + ", " + cm.endIndex + "]");
List<CorefMention> cms = c.getCorefMentions();
System.out.print("Mentions:\n");
for (CorefMention mention : cms) {