<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -34,3 +34,21 @@ Running the following at the top level:
 	  parse    822927     28000  93411000      2000  1645854000
 	project   7660000   3414000  16781000         5  38300000
 	  scale   2086476     15000  141573000      1117  2330594000
+
+### Change to `inner` so it destructures the map into `[k v]` 
+
+	   Name      mean       min       max     count       sum
+	    add    129289     29000   5447000       557  72014000
+	correct   4408249    674000  147886000       557  2455395000
+	 dhinge      8463      6000    268000       557   4714000
+	  hinge      3049      1000    256000      1557   4748000
+	  inner    103973      7000  13144000      2005  208466000
+	   norm   5306800   2422000  13169000         5  26534000
+	  parse    893034     33000  93633000      2000  1786069000
+	project   6854800   3982000  13177000         5  34274000
+	  scale   2071798     15000  147741000      1117  2314199000
+	
+
+Other changes
+-------------
+* Changed `assoc` call in `vec/pointwise` to `conj` and noticed no improvement.
\ No newline at end of file</diff>
      <filename>online/notes.md</filename>
    </modified>
    <modified>
      <diff>@@ -56,10 +56,13 @@
    (prof :correct
       (let [eta    (rate t lambda)
             dloss  (loss/deriv loss-fn y v)
-            grad   (add (scale lambda w) (scale dloss x))
-            w-new  (add w (scale (- eta) grad))]
+            w-new  (add
+                     (scale (- 1 (* eta lambda)) w)
+                     (scale (* (- eta) dloss) x))  ]
          (if (zero? (mod t proj-rate))
-            (project w-new (radius lambda))
+            (project
+               w-new
+               (radius lambda))
             w-new))))
 
 (defn step</diff>
      <filename>online/sgd.clj</filename>
    </modified>
    <modified>
      <diff>@@ -10,20 +10,27 @@
    [v] (count v))
 
 (defn add
-   &quot;Returns the sparse sum of two sparse vectors x and y&quot; 
+   &quot;Returns the sparse sum of two sparse vectors x and y.
+    (More efficient if sparsest vector is y)&quot; 
    [x y] 
    (prof :add 
       (merge-with + x y)))
 
 (defn inner
-   &quot;Returns the inner product of the vectors x and y&quot;
+   &quot;Returns the inner product of the vectors x and y.
+    (More efficient if sparsest vector is y)&quot;
    [x y]
    (prof :inner 
-      (reduce + (map #(* (get x % 0) (get y % 0)) (keys y)))))
+      (reduce + 
+         (map 
+            (fn [[k v]] (* (get x k 0) v))
+            y))))
 
 (defn norm
    &quot;Returns the l_2 norm of the (sparse) vector v&quot;
-   [v] (Math/sqrt (inner v v)))
+   [v] 
+   (prof :norm
+      (Math/sqrt (inner v v))))
 
 (defn pointwise
    &quot;Returns the vector resulting from applying f to the values in x&quot;</diff>
      <filename>online/vec.clj</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>208979f13c9380e3e706b62947c971c132eb6126</id>
    </parent>
  </parents>
  <author>
    <name>mreid</name>
    <email>mark@reid.name</email>
  </author>
  <url>http://github.com/mreid/injuce/commit/e59eb4055b2eb944cd538d7d5b08cf7671cce8cf</url>
  <id>e59eb4055b2eb944cd538d7d5b08cf7671cce8cf</id>
  <committed-date>2009-10-08T03:32:56-07:00</committed-date>
  <authored-date>2009-10-08T03:32:56-07:00</authored-date>
  <message>Refactor of gradient calculation. Minor tweak to inner</message>
  <tree>8d8e1332daf6e7c95bce78a5f593abeba24a7a32</tree>
  <committer>
    <name>mreid</name>
    <email>mark@reid.name</email>
  </committer>
</commit>
