mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r919947 - in /websites/staging/mahout/trunk/content: ./ users/sparkbindings/play-with-shell.html
Date Wed, 20 Aug 2014 20:57:25 GMT
Author: buildbot
Date: Wed Aug 20 20:57:24 2014
New Revision: 919947

Log:
Staging update by buildbot for mahout

Modified:
    websites/staging/mahout/trunk/content/   (props changed)
    websites/staging/mahout/trunk/content/users/sparkbindings/play-with-shell.html

Propchange: websites/staging/mahout/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Aug 20 20:57:24 2014
@@ -1 +1 @@
-1619188
+1619229

Modified: websites/staging/mahout/trunk/content/users/sparkbindings/play-with-shell.html
==============================================================================
--- websites/staging/mahout/trunk/content/users/sparkbindings/play-with-shell.html (original)
+++ websites/staging/mahout/trunk/content/users/sparkbindings/play-with-shell.html Wed Aug
20 20:57:24 2014
@@ -435,16 +435,14 @@ val yFitted = (drmX %*% beta).collect(::
 <p>We hope that we could show that Mahout's shell allows people to interactively and
incrementally write algorithms. We have entered a lot of individual commands, one-by-one,
until we got the desired results. We can now refactor a little by wrapping our statements
into easy-to-use functions. The definition of functions follows standard scala syntax. </p>
 <p>We put all the commands for ordinary least squares into a function <code>ols</code>.
</p>
 <div class="codehilite"><pre>
-def ols(drmX: DrmLike[Int], y: Vector) = {
+def ols(drmX: DrmLike[Int], y: Vector) = 
+  solve(drmX.t %*% drmX, drmX.t %*% y)(::,0)
 
-  val XtX = (drmX.t %*% drmX).collect
-  val Xty = (drmX.t %*% y).collect(::, 0)
-
-  solve(XtX, Xty)
-}
 </pre></div>
 
-<p>And we define a function <code>goodnessOfFit</code> that tells how well
a model fits the target variable:</p>
+<p>Note that DSL declares implicit <code>collect</code> if coersion rules
require an in-core argument. Hence, we can simply
+skip explicit <code>collect</code>s. </p>
+<p>Next, we define a function <code>goodnessOfFit</code> that tells how
well a model fits the target variable:</p>
 <div class="codehilite"><pre>
 def goodnessOfFit(drmX: DrmLike[Int], beta: Vector, y: Vector) = {
   val fittedY = (drmX %*% beta).collect(::, 0)



Mime
View raw message